where the second call to {@link #data(DataInfo,Callback)} has a timeout smaller than the previous call.
The behavior of such style of invocations is unspecified (it may even throw an exception - similar to {@link WritePendingException}).
The correct sending of data frames is the following:
final Stream stream = ...; ... // Blocking version stream.data(new StringDataInfo("chunk1", false)).get(1, TimeUnit.SECONDS); stream.data(new StringDataInfo("chunk2", true)).get(1, TimeUnit.SECONDS); // Asynchronous version stream.data(new StringDataInfo("chunk1", false), 1, TimeUnit.SECONDS, new Handler.Adapter<Void>() { public void completed(Void context) { stream.data(new StringDataInfo("chunk2", true)); } });@see StreamFrameListener
A Stream can be implemented to perform specific actions on callbacks (doNext,doComplete,doError,doSubscribe). It is an asynchronous boundary and will run the callbacks using the input {@link Dispatcher}. Stream can eventually produce a result {@param * Typically, new {@code Stream} aren't created directly. To create a {@code Stream}, create a {@link Streams} and configure it with the appropriate {@link Environment}, {@link Dispatcher}, and other settings.
@param < O> The type of the output values
@author Stephane Maldini
@author Jon Brisbin
@since 1.1, 2.0
|
|
|
|