java.lang.Object
net.pincette.rs.ProcessorBase<T,R>
net.pincette.rs.Buffered<T,R>
- Type Parameters:
T
- the incoming value type.R
- the outgoing value type.
- All Implemented Interfaces:
Flow.Processor<T,
,R> Flow.Publisher<R>
,Flow.Subscriber<T>
- Direct Known Subclasses:
Buffer
,Encode
,FlattenList
,Per
Base class for buffered processors. It uses a shared thread.
- Since:
- 3.0
- Author:
- Werner Donnè
-
Field Summary
Fields inherited from class net.pincette.rs.ProcessorBase
subscriber, subscription
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
emit()
Triggers the downstream emission flow.protected void
emit
(long number) protected long
Returns the number of requested elements by the downstream.protected boolean
Indicates whether the stream is completed.protected void
last()
This is called when the stream has completed.void
void
void
protected abstract boolean
onNextAction
(T value) TheonNext
method uses this method.void
onSubscribe
(Flow.Subscription subscription)
-
Constructor Details
-
Buffered
protected Buffered(int requestSize) Create a buffered processor.- Parameters:
requestSize
- the number of elements that will be requested from the upstream.
-
-
Method Details
-
addValues
-
dispatch
-
emit
protected void emit(long number) - Specified by:
emit
in classProcessorBase<T,
R>
-
emit
protected void emit()Triggers the downstream emission flow. TheonNextAction
method could use this. -
getRequested
protected long getRequested()Returns the number of requested elements by the downstream.- Returns:
- The requested elements number.
-
isCompleted
protected boolean isCompleted()Indicates whether the stream is completed.- Returns:
- The completes status.
-
last
protected void last()This is called when the stream has completed. It provides subclasses with the opportunity to flush any remaining data to the buffer. -
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceFlow.Subscriber<T>
- Overrides:
onComplete
in classProcessorBase<T,
R>
-
onError
- Specified by:
onError
in interfaceFlow.Subscriber<T>
- Overrides:
onError
in classProcessorBase<T,
R>
-
onNext
-
onNextAction
TheonNext
method uses this method.- Parameters:
value
- the received value.
-
onSubscribe
- Specified by:
onSubscribe
in interfaceFlow.Subscriber<T>
- Overrides:
onSubscribe
in classProcessorBase<T,
R>
-