T - Type of items stored in this holder.public interface PublisherProcessorSignalsHolder<T>
PublisherSource.Processor. A PublisherSource.Processor decouples production of data from
the consumption of data and this holder acts as the implementation for that
decoupling by using an intermediate in-memory storage. This in-memory storage layer can be used in different ways,
some of which are enumerated below:
tryConsume(ProcessorSignalsConsumer)
and tryConsumeTerminal(ProcessorSignalsConsumer)) is always done serially however the production (methods
add(Object), terminate(Throwable) and terminate()) can be done concurrently.| Modifier and Type | Method and Description |
|---|---|
void |
add(T item)
Adds an item to this holder.
|
void |
terminate()
Terminates this holder, such that no further modifications of this holder are allowed.
|
void |
terminate(Throwable cause)
Terminates this holder, such that no further modifications of this holder are allowed.
|
boolean |
tryConsume(ProcessorSignalsConsumer<T> consumer)
Try to consume the next item stored in this holder.
|
boolean |
tryConsumeTerminal(ProcessorSignalsConsumer<T> consumer)
If there are no items stored in the holder and the holder has terminated
successfully or
with an error then consume that
successful or
failed termination. |
void add(@Nullable
T item)
item - to add.void terminate()
consumptions must first consume all previously added
items and then ProcessorSignalsConsumer.consumeTerminal() consume termination}.void terminate(Throwable cause)
consumptions must first consume all previously added items
and then ProcessorSignalsConsumer.consumeTerminal() consume termination}.cause - Throwable as a cause for termination.boolean tryConsume(ProcessorSignalsConsumer<T> consumer)
successfully or with an error then consume that
successful or
failed termination.consumer - ProcessorSignalsConsumer to consume the next item or termination in this holdertrue if any method was called on the passed ProcessorSignalsConsumer.boolean tryConsumeTerminal(ProcessorSignalsConsumer<T> consumer)
successfully or
with an error then consume that
successful or
failed termination. If there are items in the holder
then this method does nothing.consumer - ProcessorSignalsConsumer to consume the next item or termination in this holdertrue if a terminal event was consumed by the passed ProcessorSignalsConsumer.