Top Description Fields Constructors Methods
stormpot

pack-priv final Class RefillPile<T extends Poolable>

extends AtomicReference<RefillSlot<T extends Poolable>>
Class Inheritance
Annotations
@SuppressWarnings:unchecked
Imports
java.util.concurrent.BlockingQueue, java.util.concurrent.atomic.AtomicReference

A `RefillPile` can collect objects, in a concurrent and wait-free manner, before releasing them all to a queue.

Field Summary

Modifier and TypeField and Description
private final BlockingQueue<BSlot<T>>
private static final long
private static final RefillSlot<Poolable>

Constructor Summary

AccessConstructor and Description
pack-priv
RefillPile(BlockingQueue<BSlot<T>> refillQueue)

Method Summary

Modifier and TypeMethod and Description
private boolean
pack-priv BSlot<T>
pop()

pack-priv void
push(BSlot<T>
The slot instance to be pushed onto the stack.
slot
)

Push the given slot onto the stack.

pack-priv boolean

Returns:

`true` if any slots has been offered to the queue, or `false` if there were no slots in the pile.
refill
()

Refill the target queue with all the slots that have been pushed onto this stack.

public String
toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.
Inherited from java.util.concurrent.atomic.AtomicReference:
accumulateAndGetcompareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndAccumulategetAndSetgetAndUpdategetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleaseupdateAndGetweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

refillQueueback to summary
private final BlockingQueue<BSlot<T>> refillQueue
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicReference.serialVersionUID.

STACK_ENDback to summary
private static final RefillSlot<Poolable> STACK_END

Constructor Detail

RefillPileback to summary
pack-priv RefillPile(BlockingQueue<BSlot<T>> refillQueue)

Method Detail

pauseback to summary
private boolean pause()
popback to summary
pack-priv BSlot<T> pop()
pushback to summary
pack-priv void push(BSlot<T> slot)

Push the given slot onto the stack. This method is wait-free.

Parameters
slot:BSlot<T>

The slot instance to be pushed onto the stack.

refillback to summary
pack-priv boolean refill()

Refill the target queue with all the slots that have been pushed onto this stack. This method atomically pops all elements from the stack at once, and then pushed onto the queue one by one.

Returns:boolean

`true` if any slots has been offered to the queue, or `false` if there were no slots in the pile.

toStringback to summary
public String toString()

Overrides java.util.concurrent.atomic.AtomicReference.toString.

Doc from java.util.concurrent.atomic.AtomicReference.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override