Modifier and Type | Class and Description |
---|---|
private static class | Recycler.
This is an implementation of |
private static class | |
public abstract static class | |
public static interface | |
private static class |
Modifier and Type | Field and Description |
---|---|
private static final boolean | |
private static final boolean | |
private final int | |
private static final int | |
private static final int | |
private static final int | |
private final int | |
private static final InternalLogger | |
private final int | |
private static final Recycler. | |
private static final int | |
private final FastThreadLocal |
Access | Constructor and Description |
---|---|
protected | |
protected | |
protected | Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor)
Deprecated
Use one of the following instead:
Recycler() , Recycler(int) , Recycler(int, int, int) .
|
protected | Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor, int ratio, int maxDelayedQueuesPerThread)
Deprecated
Use one of the following instead:
Recycler() , Recycler(int) , Recycler(int, int, int) .
|
protected | Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor, int ratio, int maxDelayedQueuesPerThread, int delayedQueueRatio)
Deprecated
Use one of the following instead:
Recycler() , Recycler(int) , Recycler(int, int, int) .
|
protected |
Modifier and Type | Method and Description |
---|---|
public final T | |
protected abstract T | |
public final boolean | |
pack-priv final int |
BATCH_FAST_TL_ONLY | back to summary |
---|---|
private static final boolean BATCH_FAST_TL_ONLY |
BLOCKING_POOL | back to summary |
---|---|
private static final boolean BLOCKING_POOL |
chunkSize | back to summary |
---|---|
private final int chunkSize |
DEFAULT_INITIAL_MAX_CAPACITY_PER_THREAD | back to summary |
---|---|
private static final int DEFAULT_INITIAL_MAX_CAPACITY_PER_THREAD |
DEFAULT_MAX_CAPACITY_PER_THREAD | back to summary |
---|---|
private static final int DEFAULT_MAX_CAPACITY_PER_THREAD |
DEFAULT_QUEUE_CHUNK_SIZE_PER_THREAD | back to summary |
---|---|
private static final int DEFAULT_QUEUE_CHUNK_SIZE_PER_THREAD |
interval | back to summary |
---|---|
private final int interval |
logger | back to summary |
---|---|
private static final InternalLogger logger |
maxCapacityPerThread | back to summary |
---|---|
private final int maxCapacityPerThread |
NOOP_HANDLE | back to summary |
---|---|
private static final Recycler. |
RATIO | back to summary |
---|---|
private static final int RATIO |
threadLocal | back to summary |
---|---|
private final FastThreadLocal<Recycler. |
Recycler | back to summary |
---|---|
protected Recycler() |
Recycler | back to summary |
---|---|
protected Recycler(int maxCapacityPerThread) |
Recycler | back to summary |
---|---|
protected Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor)
Deprecated Use one of the following instead:
|
Recycler | back to summary |
---|---|
protected Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor, int ratio, int maxDelayedQueuesPerThread)
Deprecated Use one of the following instead:
|
Recycler | back to summary |
---|---|
protected Recycler(int maxCapacityPerThread, int maxSharedCapacityFactor, int ratio, int maxDelayedQueuesPerThread, int delayedQueueRatio)
Deprecated Use one of the following instead:
|
Recycler | back to summary |
---|---|
protected Recycler(int maxCapacityPerThread, int ratio, int chunkSize) |
get | back to summary |
---|---|
public final T get()
|
newObject | back to summary |
---|---|
protected abstract T newObject(Recycler. |
recycle | back to summary |
---|---|
public final boolean recycle(T o, Recycler. Deprecated
|
threadLocalSize | back to summary |
---|---|
pack-priv final int threadLocalSize()
|
MessagePassingQueue
, similar to what might be returned from
PlatformDependent#newMpscQueue(int)
, but intended to be used for debugging purpose.
The implementation relies on synchronised monitor locks for thread-safety.
The fill
bulk operation is not supported by this implementation.
Modifier and Type | Field and Description |
---|---|
private final Queue | |
private final int |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public int | |
public synchronized void | clear()
Implements io. |
public int | drain(MessagePassingQueue.
Implements io. |
public int | drain(MessagePassingQueue.
Implements io. |
public void | drain(MessagePassingQueue.
Implements io. |
public int | fill(MessagePassingQueue.
Implements io. |
public int | fill(MessagePassingQueue.
Implements io. |
public void | fill(MessagePassingQueue.
Implements io. |
public synchronized boolean | isEmpty()
Implements io. |
public synchronized boolean | offer(T
not e)null , will throw NPE if it isImplements io. Queue#offer(Object) interface.
|
public synchronized T | peek()
Implements io. Queue#peek() interface.
|
public synchronized T | poll()
Implements io. Queue#poll() interface.
|
public boolean | relaxedOffer(T
not e)null , will throw NPE if it isImplements io. |
public T | relaxedPeek()
Implements io. |
public T | relaxedPoll()
Implements io. |
public synchronized int | size()
Implements io. |
deque | back to summary |
---|---|
private final Queue<T> deque |
maxCapacity | back to summary |
---|---|
private final int maxCapacity |
BlockingMessageQueue | back to summary |
---|---|
pack-priv BlockingMessageQueue(int maxCapacity) |
capacity | back to summary |
---|---|
public int capacity() Implements io.
|
clear | back to summary |
---|---|
public synchronized void clear() Implements io. Doc from io. Removes all items from the queue. Called from the consumer thread subject to the restrictions
appropriate to the implementation and according to the
|
drain | back to summary |
---|---|
public int drain(MessagePassingQueue. Implements io. Doc from io. Remove up to limit elements from the queue and hand to consume. This should be semantically similar to:
There's no strong commitment to the queue being empty at the end of a drain. Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
drain | back to summary |
---|---|
public int drain(MessagePassingQueue. Implements io. Doc from io. Remove all available item from the queue and hand to consume. This should be semantically similar to: M m; while((m = relaxedPoll()) != null){ c.accept(m); }There's no strong commitment to the queue being empty at the end of a drain. Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
drain | back to summary |
---|---|
public void drain(MessagePassingQueue. Implements io. Doc from io. Remove elements from the queue and hand to consume forever. Semantically similar to:
int idleCounter = 0; while (exit.keepRunning()) { E e = relaxedPoll(); if(e==null){ idleCounter = wait.idle(idleCounter); continue; } idleCounter = 0; c.accept(e); } Called from a consumer thread subject to the restrictions appropriate to the implementation. Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public int fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with up to limit elements from the supplier. Semantically similar to:
There's no strong commitment to the queue being full at the end of a fill. Called from a producer thread subject to the restrictions appropriate to the implementation Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public int fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with elements from the supplier. Semantically similar to: while(relaxedOffer(s.get());There's no strong commitment to the queue being full at the end of a fill. Called from a producer thread subject to the restrictions appropriate to the implementation. Unbounded queues will fill up the queue with a fixed amount rather than fill up to oblivion Warning Explicit assumptions are made with regards to
|
fill | back to summary |
---|---|
public void fill(MessagePassingQueue. Implements io. Doc from io. Stuff the queue with elements from the supplier forever. Semantically similar to:
Called from a producer thread subject to the restrictions appropriate to the implementation. The main difference
being that implementors MUST assure room in the queue is available BEFORE calling Warning Explicit assumptions are made with regards to
|
isEmpty | back to summary |
---|---|
public synchronized boolean isEmpty() Implements io. Doc from io. This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
|
offer | back to summary |
---|---|
public synchronized boolean offer(T e) Implements io. Doc from io. Called from a producer thread subject to the restrictions appropriate to the implementation and
according to the
|
peek | back to summary |
---|---|
public synchronized T peek() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation and
according to the
|
poll | back to summary |
---|---|
public synchronized T poll() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation and
according to the
|
relaxedOffer | back to summary |
---|---|
public boolean relaxedOffer(T e) Implements io. Doc from io. Called from a producer thread subject to the restrictions appropriate to the implementation. As opposed
to
|
relaxedPeek | back to summary |
---|---|
public T relaxedPeek() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation. As
opposed to
|
relaxedPoll | back to summary |
---|---|
public T relaxedPoll() Implements io. Doc from io. Called from the consumer thread subject to the restrictions appropriate to the implementation. As
opposed to
|
size | back to summary |
---|---|
public synchronized int size() Implements io. Doc from io. This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value. For some implementations this method may be O(n) rather than O(1).
|
Modifier and Type | Field and Description |
---|---|
private final Recycler. | |
private volatile int | |
private static final int | |
private static final int | |
private static final AtomicIntegerFieldUpdater | |
private T |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
pack-priv T | |
public void | recycle(Object object)
Implements io. Object if possible and so make it ready to be reused.
|
pack-priv void | |
pack-priv void | |
pack-priv void | |
public void | unguardedRecycle(Object object)
Implements abstract io. |
pack-priv void |
localPool | back to summary |
---|---|
private final Recycler. |
state | back to summary |
---|---|
private volatile int state |
STATE_AVAILABLE | back to summary |
---|---|
private static final int STATE_AVAILABLE |
STATE_CLAIMED | back to summary |
---|---|
private static final int STATE_CLAIMED |
STATE_UPDATER | back to summary |
---|---|
private static final AtomicIntegerFieldUpdater<Recycler. |
value | back to summary |
---|---|
private T value |
DefaultHandle | back to summary |
---|---|
pack-priv DefaultHandle(Recycler. |
get | back to summary |
---|---|
pack-priv T get() |
recycle | back to summary |
---|---|
public void recycle(Object object) Implements io. Doc from io. Recycle the
|
set | back to summary |
---|---|
pack-priv void set(T value) |
toAvailable | back to summary |
---|---|
pack-priv void toAvailable() |
toClaimed | back to summary |
---|---|
pack-priv void toClaimed() |
unguardedRecycle | back to summary |
---|---|
public void unguardedRecycle(Object object) Implements abstract io.
|
unguardedToAvailable | back to summary |
---|---|
pack-priv void unguardedToAvailable() |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public abstract void |
EnhancedHandle | back to summary |
---|---|
private EnhancedHandle() |
unguardedRecycle | back to summary |
---|---|
public abstract void unguardedRecycle(Object object) |
Modifier and Type | Field and Description |
---|---|
private final ArrayDeque | |
private final int | |
private volatile Thread | |
private volatile MessagePassingQueue | |
private int | |
private final int |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | accept(Recycler.
not enull Implements io. |
pack-priv Recycler. | |
private static boolean | |
pack-priv Recycler. | |
pack-priv void |
batch | back to summary |
---|---|
private final ArrayDeque<Recycler. |
chunkSize | back to summary |
---|---|
private final int chunkSize |
owner | back to summary |
---|---|
private volatile Thread owner |
pooledHandles | back to summary |
---|---|
private volatile MessagePassingQueue<Recycler. |
ratioCounter | back to summary |
---|---|
private int ratioCounter |
ratioInterval | back to summary |
---|---|
private final int ratioInterval |
LocalPool | back to summary |
---|---|
pack-priv LocalPool(int maxCapacity, int ratioInterval, int chunkSize)
|
accept | back to summary |
---|---|
public void accept(Recycler. Implements io. Doc from io. This method will process an element already removed from the queue. This method is expected to never throw an exception. Users should be aware that underlying queue implementations may upfront claim parts of the queue for batch operations and this will effect the view on the queue from the accept method. In particular size and any poll/peek methods may take the view that the full batch has already happened. Warning this method is assumed to never throw. Breaking this assumption can lead to a broken queue.
|
claim | back to summary |
---|---|
pack-priv Recycler. |
isTerminated | back to summary |
---|---|
private static boolean isTerminated(Thread owner) |
newHandle | back to summary |
---|---|
pack-priv Recycler. |
release | back to summary |
---|---|
pack-priv void release(Recycler. |