- 
- Type Parameters:
- T- the items type
 
 public interface Tube<T>ATubeis a general-purpose abstraction for creatingPublisher.Items, errors and completion signals can be sent using this interface. It is possible to be notified of requests, cancellations and termination. A Tubecan be shared between multiple threads, and sending items from concurrent threads is done serially as per reactive stream semantics.If in doubt about which abstraction to use for creating a PublisherwithZeroPublisherthen choose aTube.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancancelled()Check if the subscription has been cancelled.voidcomplete()Signal completion and that no more items will be sent.voidfail(java.lang.Throwable err)Terminally signal an error.longoutstandingRequests()Check the number of outstanding requests.Tube<T>send(T item)Send an item.Tube<T>whenCancelled(java.lang.Runnable action)Define an action when the subscription is cancelled.Tube<T>whenRequested(java.util.function.LongConsumer consumer)Define an action when items are being requested.Tube<T>whenTerminates(java.lang.Runnable action)Define an action on termination (completion, error or cancellation), typically for cleanup purposes.
 
- 
- 
- 
Method Detail- 
failvoid fail(java.lang.Throwable err) Terminally signal an error.- Parameters:
- err- the error
 
 - 
completevoid complete() Signal completion and that no more items will be sent.
 - 
cancelledboolean cancelled() Check if the subscription has been cancelled.- Returns:
- trueif the subscriber has cancelled its subscription,- falseotherwise
 
 - 
outstandingRequestslong outstandingRequests() Check the number of outstanding requests.- Returns:
- the number of outstanding requests.
 
 - 
whenCancelledTube<T> whenCancelled(java.lang.Runnable action) Define an action when the subscription is cancelled.- Parameters:
- action- the action
- Returns:
- this Tube
 
 - 
whenTerminatesTube<T> whenTerminates(java.lang.Runnable action) Define an action on termination (completion, error or cancellation), typically for cleanup purposes.- Parameters:
- action- the action
- Returns:
- this Tube
 
 
- 
 
-