Top Description Fields Constructors Methods
org.eclipse.jetty.io.internal

public Class CompoundPool<P>

extends Object
implements Pool<P>
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Pool
Type Parameters
<P>
the type of the pooled objects
Imports
java.util.ArrayList, .Collection, java.util.stream.Stream, org.eclipse.jetty.util.Pool

A Pool implementation that uses a primary pool which overflows to a secondary pool.

Field Summary

Modifier and TypeField and Description
private final Pool<P>
private final Pool<P>

Constructor Summary

AccessConstructor and Description
public
CompoundPool(Pool<P> primaryPool, Pool<P> secondaryPool)

Method Summary

Modifier and TypeMethod and Description
public Pool.Entry<P>
acquire()

Implements org.eclipse.jetty.util.Pool.acquire.

Acquires an entry from the pool.

public int
public boolean
public Pool.Entry<P>
reserve()

Implements org.eclipse.jetty.util.Pool.reserve.

Creates a new disabled slot into the pool.

public int
public Stream<Pool.Entry<P>>
public Collection<Pool.Entry<P>>
terminate()

Implements org.eclipse.jetty.util.Pool.terminate.

Terminates this Pool.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

primaryPoolback to summary
private final Pool<P> primaryPool
secondaryPoolback to summary
private final Pool<P> secondaryPool

Constructor Detail

CompoundPoolback to summary
public CompoundPool(Pool<P> primaryPool, Pool<P> secondaryPool)

Method Detail

acquireback to summary
public Pool.Entry<P> acquire()

Implements org.eclipse.jetty.util.Pool.acquire.

Doc from org.eclipse.jetty.util.Pool.acquire.

Acquires an entry from the pool.

Only enabled entries will be returned from this method and their Entry#enable(Object, boolean) method must not be called.

Returns:Pool.Entry<P>

an entry from the pool or null if none is available.

Annotations
@Override
getMaxSizeback to summary
public int getMaxSize()

Implements org.eclipse.jetty.util.Pool.getMaxSize.

Returns:int

Doc from org.eclipse.jetty.util.Pool.getMaxSize.

the maximum number of entries in this Pool

Annotations
@Override
isTerminatedback to summary
public boolean isTerminated()

Implements org.eclipse.jetty.util.Pool.isTerminated.

Returns:boolean

Doc from org.eclipse.jetty.util.Pool.isTerminated.

whether this Pool has been terminated

Annotations
@Override
reserveback to summary
public Pool.Entry<P> reserve()

Implements org.eclipse.jetty.util.Pool.reserve.

Doc from org.eclipse.jetty.util.Pool.reserve.

Creates a new disabled slot into the pool.

The returned entry must ultimately have the Entry#enable(Object, boolean) method called or be removed via Pool.Entry#remove().

Returns:Pool.Entry<P>

a disabled entry that is contained in the pool, or null if the pool is terminated or if the pool cannot reserve an entry

Annotations
@Override
sizeback to summary
public int size()

Implements org.eclipse.jetty.util.Pool.size.

Returns:int

Doc from org.eclipse.jetty.util.Pool.size.

the current number of entries in this Pool

Annotations
@Override
streamback to summary
public Stream<Pool.Entry<P>> stream()

Implements org.eclipse.jetty.util.Pool.stream.

Returns:Stream<Pool.Entry<P>>

Doc from org.eclipse.jetty.util.Pool.stream.

a Stream over the entries

Annotations
@Override
terminateback to summary
public Collection<Pool.Entry<P>> terminate()

Implements org.eclipse.jetty.util.Pool.terminate.

Doc from org.eclipse.jetty.util.Pool.terminate.

Terminates this Pool.

All the entries are marked as terminated and cannot be acquired nor released, but only removed.

The returned list of all entries may be iterated to perform additional operations on the pooled objects.

The pool cannot be used anymore after it is terminated.

Returns:Collection<Pool.Entry<P>>

a list of all entries

Annotations
@Override