T - the type of messages this buffer containpublic class RoundRobinMultiReadonlyBuffer<T> extends Object implements DisposableReadonlyBuffer<T>
DisposableReadonlyBuffer that operates across multiple DisposableReadonlyBuffer instances. Operations are delegated to these instances in a round-robin fashion.| Constructor and Description |
|---|
RoundRobinMultiReadonlyBuffer(List<? extends DisposableReadonlyBuffer<T>> buffers)
Instantiates this buffer with a list of delegates.
|
| Modifier and Type | Method and Description |
|---|---|
int |
capacity()
Sums up capacities of all buffers.
|
boolean |
closed()
Checks whether all buffers are closed.
|
void |
dispose()
Calls a
DisposableReadonlyBuffer.dispose() on each and every buffer. |
Optional<ErrorMessage> |
error()
Retrieves an error from the first buffer if all buffers errored out.
|
boolean |
isEmpty()
Checks whether all buffers are empty.
|
void |
onAvailable(Runnable onAvailable)
Registers
onAvailable handler to all buffers |
Optional<T> |
poll()
Polls the element from one of the buffers in a round-robin fashion.
|
public RoundRobinMultiReadonlyBuffer(List<? extends DisposableReadonlyBuffer<T>> buffers)
buffers - a list of delegatespublic Optional<T> poll()
poll in interface CloseableReadonlyBuffer<T>Optional with polled messageCloseableReadonlyBuffer.poll()public boolean closed()
closed in interface CloseableReadonlyBuffer<T>true if all buffers are closed, false otherwiseCloseableReadonlyBuffer.closed()public Optional<ErrorMessage> error()
error in interface CloseableReadonlyBuffer<T>CloseableReadonlyBuffer.error()public boolean isEmpty()
isEmpty in interface CloseableReadonlyBuffer<T>true if all buffers are empty, false otherwiseCloseableReadonlyBuffer.isEmpty()public int capacity()
capacity in interface CloseableReadonlyBuffer<T>CloseableReadonlyBuffer.capacity()public void onAvailable(Runnable onAvailable)
onAvailable handler to all buffersonAvailable in interface CloseableReadonlyBuffer<T>onAvailable - to be invoked when there are changes in buffersCloseableReadonlyBuffer.onAvailable(Runnable)public void dispose()
DisposableReadonlyBuffer.dispose() on each and every buffer.dispose in interface DisposableReadonlyBuffer<T>DisposableReadonlyBuffer.dispose()Copyright © 2020–2022 AxonIQ BV. All rights reserved.