T
- the type of element signaled to the Subscriber
public abstract class AbstractListenerWriteFlushProcessor<T> extends Object implements Processor<Publisher<? extends T>,Void>
AbstractListenerWriteProcessor
but instead writing
a Publisher<Publisher<T>>
with flush boundaries enforces after
the completion of each nested Publisher.Modifier and Type | Field and Description |
---|---|
protected static Log |
rsWriteFlushLogger
Special logger for debugging Reactive Streams signals.
|
Constructor and Description |
---|
AbstractListenerWriteFlushProcessor() |
AbstractListenerWriteFlushProcessor(String logPrefix)
Create an instance with the given log prefix.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
Cancel the upstream chain of "write" Publishers only, for example due to
Servlet container error/completion notifications.
|
protected abstract Processor<? super T,Void> |
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. |
protected void |
flushingFailed(Throwable t)
Invoked when an error happens while flushing.
|
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(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(Publisher<? extends T> publisher) |
void |
onSubscribe(Subscription subscription) |
void |
subscribe(Subscriber<? super Void> subscriber) |
protected static final Log rsWriteFlushLogger
LogDelegateFactory.getHiddenLog(Class)
,
AbstractListenerReadPublisher.rsReadLogger
,
AbstractListenerWriteProcessor.rsWriteLogger
,
WriteResultPublisher.rsWriteResultLogger
public AbstractListenerWriteFlushProcessor()
public AbstractListenerWriteFlushProcessor(String logPrefix)
public String getLogPrefix()
public final void onSubscribe(Subscription subscription)
onSubscribe
in interface Subscriber<Publisher<? extends T>>
public final void onNext(Publisher<? extends T> publisher)
onNext
in interface Subscriber<Publisher<? extends T>>
public final void onError(Throwable ex)
onError
in interface Subscriber<Publisher<? extends T>>
public final void onComplete()
onComplete
in interface Subscriber<Publisher<? extends T>>
protected final void onFlushPossible()
isWritePossible()
, or as a callback from the underlying
container.protected void cancel()
onError(Throwable)
or
onComplete()
to notify the downstream chain, that is unless
cancellation came from downstream.public final void subscribe(Subscriber<? super Void> subscriber)
protected abstract Processor<? super T,Void> createWriteProcessor()
protected abstract boolean isWritePossible()
protected abstract void flush() throws 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.
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(Throwable t)
The default implementation cancels the upstream write publisher and sends an onError downstream as the result of request handling.