T - the type of messages this buffer deals withpublic class FlowControlledDisposableReadonlyBuffer<T> extends Object implements DisposableReadonlyBuffer<T>
FlowControl instance with a DisposableReadonlyBuffer assuming that requesting from the flow control will trigger a replenishment of the buffer.| Constructor and Description |
|---|
FlowControlledDisposableReadonlyBuffer(FlowControl flowControl,
CloseableReadonlyBuffer<T> buffer)
Instantiates this buffer with the given
flowControl and buffer. |
| Modifier and Type | Method and Description |
|---|---|
int |
capacity()
Returns the overall capacity of this buffer.
|
boolean |
closed()
Indicates whether the buffer is closed by the producing side.
|
void |
dispose()
Disposes this buffer from the subscriber's side.
|
Optional<ErrorMessage> |
error()
Returns an error from this buffer, if any.
|
boolean |
isEmpty()
Indicates whether there are messages in the buffer.
|
void |
onAvailable(Runnable onAvailable)
Registers an action to be triggered when there is a new message added to the buffer, or the buffer is closed, or
the buffer is closed with an error.
|
Optional<T> |
poll()
Polls the message from this buffer.
|
public FlowControlledDisposableReadonlyBuffer(FlowControl flowControl, CloseableReadonlyBuffer<T> buffer)
flowControl and buffer.flowControl - used for buffer replenishmentbuffer - used for message retrieval on FlowControl.request(long)public Optional<T> poll()
CloseableReadonlyBufferOptional is empty, that doesn't mean that this buffer
stays empty forever. The CloseableReadonlyBuffer.closed() method should be consolidated to validate this.poll in interface CloseableReadonlyBuffer<T>Optional with polled messagepublic boolean isEmpty()
CloseableReadonlyBufferfalse, that doesn't mean that this
buffer stays empty forever. The CloseableReadonlyBuffer.closed() method should be consolidated to validate this.isEmpty in interface CloseableReadonlyBuffer<T>true if buffer is empty, false otherwisepublic int capacity()
CloseableReadonlyBuffercapacity in interface CloseableReadonlyBuffer<T>public void onAvailable(Runnable onAvailable)
CloseableReadonlyBufferCloseableReadonlyBuffer.poll(), CloseableReadonlyBuffer.closed(), and CloseableReadonlyBuffer.error()
to validate this.onAvailable in interface CloseableReadonlyBuffer<T>onAvailable - to be invoked when there are changes in this bufferpublic void dispose()
DisposableReadonlyBufferdispose in interface DisposableReadonlyBuffer<T>public boolean closed()
CloseableReadonlyBufferclosed in interface CloseableReadonlyBuffer<T>true if closed, false otherwisepublic Optional<ErrorMessage> error()
CloseableReadonlyBuffererror in interface CloseableReadonlyBuffer<T>Optional of an error, if anyCopyright © 2020–2022 AxonIQ BV. All rights reserved.