T
- the type of element signaled to the Subscriber
public abstract class AbstractListenerWriteFlushProcessor<T>
extends java.lang.Object
AbstractListenerWriteProcessor
but instead writing
a Publisher<Publisher<T>>
with flush boundaries enforces after
the completion of each nested Publisher.Modifier and Type | Class and Description |
---|---|
private static class |
AbstractListenerWriteFlushProcessor.State
Represents a state for the
Processor to be in. |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
logPrefix |
private WriteResultPublisher |
resultPublisher |
protected static Log |
rsWriteFlushLogger
Special logger for debugging Reactive Streams signals.
|
private java.util.concurrent.atomic.AtomicReference<AbstractListenerWriteFlushProcessor.State> |
state |
private boolean |
subscriberCompleted |
private Subscription |
subscription |
Constructor and Description |
---|
AbstractListenerWriteFlushProcessor() |
AbstractListenerWriteFlushProcessor(java.lang.String logPrefix)
Create an instance with the given log prefix.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
Invoked during an error or completion callback from the underlying
container to cancel the upstream subscription.
|
private boolean |
changeState(AbstractListenerWriteFlushProcessor.State oldState,
AbstractListenerWriteFlushProcessor.State newState) |
protected abstract <any> |
createWriteProcessor()
Create a new processor for the current flush boundary.
|
protected abstract void |
flush()
Flush the output if ready, or otherwise
isFlushPending() should
return true after. |
private void |
flushIfPossible() |
protected void |
flushingFailed(java.lang.Throwable t)
Invoked when an error happens while flushing.
|
java.lang.String |
getLogPrefix()
Create an instance with the given log prefix.
|
protected abstract boolean |
isFlushPending()
Whether flushing is pending.
|
protected abstract boolean |
isWritePossible()
Whether writing/flushing is possible.
|
void |
onComplete()
Completion signal from the upstream, write Publisher.
|
void |
onError(java.lang.Throwable ex)
Error signal from the upstream, write Publisher.
|
protected void |
onFlushPossible()
Invoked when flushing is possible, either in the same thread after a check
via
isWritePossible() , or as a callback from the underlying
container. |
void |
onNext(<any> publisher) |
void |
onSubscribe(Subscription subscription) |
void |
subscribe(<any> subscriber) |
protected static final Log rsWriteFlushLogger
private final java.util.concurrent.atomic.AtomicReference<AbstractListenerWriteFlushProcessor.State> state
@Nullable private Subscription subscription
private volatile boolean subscriberCompleted
private final WriteResultPublisher resultPublisher
private final java.lang.String logPrefix
public AbstractListenerWriteFlushProcessor()
public AbstractListenerWriteFlushProcessor(java.lang.String logPrefix)
public java.lang.String getLogPrefix()
public final void onSubscribe(Subscription subscription)
public final void onNext(<any> publisher)
public final void onError(java.lang.Throwable ex)
public final void onComplete()
protected final void onFlushPossible()
isWritePossible()
, or as a callback from the underlying
container.protected void cancel()
public final void subscribe(<any> subscriber)
protected abstract <any> createWriteProcessor()
protected abstract boolean isWritePossible()
protected abstract void flush() throws java.io.IOException
isFlushPending()
should
return true after.
This is primarily for the Servlet non-blocking I/O API where flush cannot be called without a readyToWrite check.
java.io.IOException
protected abstract boolean isFlushPending()
This is primarily for the Servlet non-blocking I/O API where flush cannot be called without a readyToWrite check.
protected void flushingFailed(java.lang.Throwable t)
Defaults to no-op.
private boolean changeState(AbstractListenerWriteFlushProcessor.State oldState, AbstractListenerWriteFlushProcessor.State newState)
private void flushIfPossible()