This flusher can be used to mutated and fragment Frames and forwarded them on towards the application using the
IncomingFrames provided in the constructor. This can split a single incoming frame into n Frames which are
passed on to the IncomingFrames one at a time.
The asynchronous operation performed by this IteratingCallback is demanding from upper layer after which
onFrame(Frame, Callback) will called with the new content.
This flusher relies on the interception of demand, and because of this it can only be used in an Extension which
implements the DemandChain interface. The methods of DemandChain from the Extension
must be forwarded to this flusher.
| Modifier and Type | Field and Description |
|---|---|
| private Callback | |
| private final AtomicBoolean | |
| private final IncomingFrames | |
| private final AtomicReference | |
| private boolean | |
| private Frame | |
| private boolean | |
| private DemandChain | |
| private static final Throwable |
| Access | Constructor and Description |
|---|---|
| public | DemandingFlusher(IncomingFrames
where frames generated by emitFrame)handle(Frame, Callback, boolean) are forwarded.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | emitFrame(Frame
the WebSocket frame. frame, Callback to release frame payload. callback)This is used within an implementation of |
| public void | failFlusher(Throwable
the failure. t)Used to fail this flusher possibly from an external event such as a callback. |
| protected abstract boolean | Returns: false to continue processing this frame, true to complete processing and get a new frame.the original frame. frame, Callback to succeed to release the frame payload. callback, boolean if this is the first time this method has been called for this frame. first)Called when there is demand for a single frame to be produced. |
| protected void | onCompleteFailure(Throwable
the throwable to indicate cause of failure cause)Overrides org. Invoked when the overall task has completed with a failure. |
| public void | |
| protected IteratingCallback. | process()
Implements abstract org. Method called by |
| public void | setNextDemand(DemandChain nextDemand)
Overrides default org.
|
| _callback | back to summary |
|---|---|
| private Callback _callback | |
| _demand | back to summary |
|---|---|
| private final AtomicBoolean _demand | |
| _emitFrame | back to summary |
|---|---|
| private final IncomingFrames _emitFrame | |
| _failure | back to summary |
|---|---|
| private final AtomicReference<Throwable> _failure | |
| _first | back to summary |
|---|---|
| private boolean _first | |
| _frame | back to summary |
|---|---|
| private Frame _frame | |
| _needContent | back to summary |
|---|---|
| private boolean _needContent | |
| _nextDemand | back to summary |
|---|---|
| private DemandChain _nextDemand | |
| SENTINEL_CLOSE_EXCEPTION | back to summary |
|---|---|
| private static final Throwable SENTINEL_CLOSE_EXCEPTION | |
| DemandingFlusher | back to summary |
|---|---|
public DemandingFlusher(IncomingFrames emitFrame)
| |
| closeFlusher | back to summary |
|---|---|
| public void closeFlusher() Used to close this flusher when there is no explicit failure. | |
| demand | back to summary |
|---|---|
| public void demand() Implements org.
| |
| emitFrame | back to summary |
|---|---|
| public void emitFrame(Frame frame, Callback callback) This is used within an implementation of This method should only be called ONCE within each invocation of | |
| failFlusher | back to summary |
|---|---|
| public void failFlusher(Throwable t) Used to fail this flusher possibly from an external event such as a callback.
| |
| handle | back to summary |
|---|---|
| protected abstract boolean handle(Frame frame, Callback callback, boolean first) Called when there is demand for a single frame to be produced. During this method a single call can be made
to Note that the callback supplied here is specially wrapped so that you can call it multiple times and it will not be completed more than once. This simplifies the handling of failure cases. | |
| onCompleteFailure | back to summary |
|---|---|
| protected void onCompleteFailure(Throwable cause) Overrides org. Doc from org. Invoked when the overall task has completed with a failure. | |
| onFrame | back to summary |
|---|---|
| public void onFrame(Frame frame, Callback callback) Used to supply the flusher with a new frame. This frame should only arrive if demanded
through the | |
| process | back to summary |
|---|---|
| protected IteratingCallback. Implements abstract org. Doc from org. Method called by Implementations must initiate the asynchronous execution of the sub-task (if any) and return an appropriate action:
| |
| setNextDemand | back to summary |
|---|---|
| public void setNextDemand(DemandChain nextDemand) Overrides default org.
| |