类 AbstractListenerWriteFlushProcessor<T>
java.lang.Object
cn.taketoday.http.server.reactive.AbstractListenerWriteFlushProcessor<T>
- 类型参数:
T- the type of element signaled to theSubscriber
- 所有已实现的接口:
org.reactivestreams.Processor<org.reactivestreams.Publisher<? extends T>,,Void> org.reactivestreams.Publisher<Void>,org.reactivestreams.Subscriber<org.reactivestreams.Publisher<? extends T>>
- 直接已知子类:
ServletServerHttpResponse.ResponseBodyFlushProcessor,UndertowServerHttpResponse.ResponseBodyFlushProcessor
public abstract class AbstractListenerWriteFlushProcessor<T>
extends Object
implements org.reactivestreams.Processor<org.reactivestreams.Publisher<? extends T>,Void>
An alternative to
AbstractListenerWriteProcessor but instead writing
a Publisher<Publisher<T>> with flush boundaries enforces after
the completion of each nested Publisher.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Violeta Georgieva, Rossen Stoyanchev
-
嵌套类概要
嵌套类修饰符和类型类说明private static enumRepresents a state for theProcessorto be in. -
字段概要
字段修饰符和类型字段说明private AbstractListenerWriteProcessor<?>private final Stringprivate final WriteResultPublisherprotected static final cn.taketoday.logging.LoggerSpecial logger for debugging Reactive Streams signals.private booleanprivate final AtomicReference<AbstractListenerWriteFlushProcessor.State>private org.reactivestreams.Subscription -
构造器概要
构造器构造器说明AbstractListenerWriteFlushProcessor(String logPrefix) Create an instance with the given log prefix. -
方法概要
修饰符和类型方法说明protected voidcancel()Cancel the upstream chain of "write" Publishers only, for example due to Servlet container error/completion notifications.private booleanchangeState(AbstractListenerWriteFlushProcessor.State oldState, AbstractListenerWriteFlushProcessor.State newState) Create a new processor for the current flush boundary.protected abstract voidflush()Flush the output if ready, or otherwiseisFlushPending()should return true after.private voidprotected voidInvoked when an error happens while flushing.Create an instance with the given log prefix.protected abstract booleanWhether flushing is pending.protected abstract booleanWhether writing/flushing is possible.final voidCompletion signal from the upstream, write Publisher.final voidError signal from the upstream, write Publisher.protected final voidInvoked when flushing is possible, either in the same thread after a check viaisWritePossible(), or as a callback from the underlying container.final voidfinal voidonSubscribe(org.reactivestreams.Subscription subscription) final void
-
字段详细资料
-
rsWriteFlushLogger
protected static final cn.taketoday.logging.Logger rsWriteFlushLoggerSpecial logger for debugging Reactive Streams signals.- 另请参阅:
-
LogDelegateFactory.getHiddenLog(Class)AbstractListenerReadPublisher.rsReadLoggerAbstractListenerWriteProcessor.rsWriteLoggerWriteResultPublisher.rsWriteResultLogger
-
state
-
subscription
@Nullable private org.reactivestreams.Subscription subscription -
sourceCompleted
private volatile boolean sourceCompleted -
currentWriteProcessor
-
resultPublisher
-
logPrefix
-
-
构造器详细资料
-
AbstractListenerWriteFlushProcessor
public AbstractListenerWriteFlushProcessor() -
AbstractListenerWriteFlushProcessor
Create an instance with the given log prefix.
-
-
方法详细资料
-
getLogPrefix
Create an instance with the given log prefix. -
onSubscribe
public final void onSubscribe(org.reactivestreams.Subscription subscription) - 指定者:
onSubscribe在接口中org.reactivestreams.Subscriber<T>
-
onNext
- 指定者:
onNext在接口中org.reactivestreams.Subscriber<T>
-
onError
Error signal from the upstream, write Publisher. This is also used by sub-classes to delegate error notifications from the container.- 指定者:
onError在接口中org.reactivestreams.Subscriber<T>
-
onComplete
public final void onComplete()Completion signal from the upstream, write Publisher. This is also used by sub-classes to delegate completion notifications from the container.- 指定者:
onComplete在接口中org.reactivestreams.Subscriber<T>
-
onFlushPossible
protected final void onFlushPossible()Invoked when flushing is possible, either in the same thread after a check viaisWritePossible(), or as a callback from the underlying container. -
cancel
protected void cancel()Cancel the upstream chain of "write" Publishers only, for example due to Servlet container error/completion notifications. This should usually be followed up with a call to eitheronError(Throwable)oronComplete()to notify the downstream chain, that is unless cancellation came from downstream. -
subscribe
- 指定者:
subscribe在接口中org.reactivestreams.Publisher<T>
-
createWriteProcessor
Create a new processor for the current flush boundary. -
isWritePossible
protected abstract boolean isWritePossible()Whether writing/flushing is possible. -
flush
Flush the output if ready, or otherwiseisFlushPending()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
-
isFlushPending
protected abstract boolean isFlushPending()Whether flushing is pending.This is primarily for the Servlet non-blocking I/O API where flush cannot be called without a readyToWrite check.
-
flushingFailed
Invoked when an error happens while flushing.The default implementation cancels the upstream write publisher and sends an onError downstream as the result of request handling.
-
changeState
private boolean changeState(AbstractListenerWriteFlushProcessor.State oldState, AbstractListenerWriteFlushProcessor.State newState) -
flushIfPossible
private void flushIfPossible()
-