T - the type of messages in this bufferpublic interface CloseableReadonlyBuffer<T>
| 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.
|
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.
|
Optional<T> poll()
Optional is empty, that doesn't mean that this buffer
stays empty forever. The closed() method should be consolidated to validate this.Optional with polled messageboolean isEmpty()
false, that doesn't mean that this
buffer stays empty forever. The closed() method should be consolidated to validate this.true if buffer is empty, false otherwiseint capacity()
void onAvailable(Runnable onAvailable)
poll(), closed(), and error()
to validate this.onAvailable - to be invoked when there are changes in this bufferboolean closed()
true if closed, false otherwiseOptional<ErrorMessage> error()
Optional of an error, if anyCopyright © 2020–2023 AxonIQ BV. All rights reserved.