Package io.activej.csp.queue
Class ChannelBufferWithFallback<T>
java.lang.Object
io.activej.csp.queue.ChannelBufferWithFallback<T>
- All Implemented Interfaces:
io.activej.async.process.AsyncCloseable,ChannelConsumerTransformer<T,,ChannelConsumer<T>> ChannelSupplierTransformer<T,,ChannelSupplier<T>> ChannelTransformer<T,,T> ChannelQueue<T>
-
Field Summary
Fields inherited from interface io.activej.async.process.AsyncCloseable
STATIC -
Constructor Summary
ConstructorsConstructorDescriptionChannelBufferWithFallback(ChannelQueue<T> queue, Supplier<io.activej.promise.Promise<? extends ChannelQueue<T>>> bufferFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoidio.activej.promise.Promise<T>doTake()@Nullable Exceptionbooleanbooleanio.activej.promise.Promise<Void>Puts an item in the queue and returns apromiseofnullas a marker of completion.io.activej.promise.Promise<T>take()Takes an element of this queue and wraps it inpromise.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.activej.async.process.AsyncCloseable
closeMethods inherited from interface io.activej.csp.queue.ChannelQueue
getConsumer, getConsumer, getSupplier, transform, transform
-
Constructor Details
-
ChannelBufferWithFallback
public ChannelBufferWithFallback(ChannelQueue<T> queue, Supplier<io.activej.promise.Promise<? extends ChannelQueue<T>>> bufferFactory)
-
-
Method Details
-
put
Description copied from interface:ChannelQueuePuts an item in the queue and returns apromiseofnullas a marker of completion.- Specified by:
putin interfaceChannelQueue<T>- Parameters:
item- a item passed to the queue- Returns:
promiseofnullas a marker of completion
-
take
Description copied from interface:ChannelQueueTakes an element of this queue and wraps it inpromise.- Specified by:
takein interfaceChannelQueue<T>- Returns:
- a
promiseof value from the queue
-
doTake
-
isSaturated
public boolean isSaturated()- Specified by:
isSaturatedin interfaceChannelQueue<T>
-
isExhausted
public boolean isExhausted()- Specified by:
isExhaustedin interfaceChannelQueue<T>
-
closeEx
- Specified by:
closeExin interfaceio.activej.async.process.AsyncCloseable
-
getException
-