E - the element typepublic final class BlockingSink<E> extends java.lang.Object implements Producer, org.reactivestreams.Subscription, Trackable, java.util.function.Consumer<E>, java.io.Closeable
Subscriber or Processor.
 The BlockingSink keeps track of the decorated Subscriber demand. Therefore any emission can be
 safely sent to
 the delegate
 Subscriber by using submit(E) to block on backpressure (missing demand) or emit(E) to
 never block and return instead an BlockingSink.Emission status.
 The emitter is itself a Subscriber that will request an unbounded value if subscribed.| Modifier and Type | Class and Description | 
|---|---|
| static class  | BlockingSink.EmissionAn acknowledgement signal returned by  emit(E). | 
UNSPECIFIED| Modifier | Constructor and Description | 
|---|---|
| protected  | BlockingSink(org.reactivestreams.Subscriber<? super E> actual) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | accept(E e) | 
| void | cancel() | 
| void | close() | 
| void | complete() | 
| static <E> BlockingSink<E> | create(org.reactivestreams.Subscriber<? super E> subscriber) | 
| static <E> BlockingSink<E> | create(org.reactivestreams.Subscriber<? super E> subscriber,
      boolean autostart) | 
| org.reactivestreams.Subscriber<? super E> | downstream()Return the direct data receiver. | 
| BlockingSink.Emission | emit(E data)A non-blocking  Subscriber.onNext(Object)that will return a statusBlockingSink.Emission. | 
| void | error(java.lang.Throwable error)Try calling  Subscriber.onError(Throwable)on the delegateSubscriber. | 
| BlockingSink.Emission | finish()Try emitting  complete()to the decoratedSubscriber. | 
| long | getCapacity()Return defined element capacity | 
| java.lang.Throwable | getError()Current error if any, default to null | 
| boolean | hasFailed() | 
| boolean | hasRequested() | 
| boolean | isCancelled() | 
| void | next(E t)Try emitting, might throw an unchecked exception. | 
| void | request(long n) | 
| long | requestedFromDownstream()Return defined element capacity, used to drive new  Subscriptionrequest needs. | 
| void | start()Subscribe the decorated actual
  Subscriber.onSubscribe(Subscription). | 
| void | stop()Marks the emitter as terminated without completing downstream | 
| long | submit(E data)Blocking  Subscriber.onNext(Object)call with an infinite wait on backpressure. | 
| long | submit(E data,
      long timeout)Blocking  Subscriber.onNext(Object)call with a timed wait on backpressure. | 
| long | submit(E data,
      long timeout,
      java.util.function.Predicate<E> dropPredicate)Blocking  Subscriber.onNext(Object)call with a timed wait on backpressure. | 
| long | submit(E data,
      long timeout,
      java.util.concurrent.TimeUnit unit)Blocking  Subscriber.onNext(Object)call with a timed wait on backpressure. | 
| long | submit(E data,
      long timeout,
      java.util.concurrent.TimeUnit unit,
      java.util.function.Predicate<E> dropPredicate)Blocking  Subscriber.onNext(Object)call with a timed wait on backpressure. | 
| java.lang.String | toString() | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitexpectedFromUpstream, getPending, isStarted, isTerminated, limitprotected BlockingSink(org.reactivestreams.Subscriber<? super E> actual)
public static <E> BlockingSink<E> create(org.reactivestreams.Subscriber<? super E> subscriber, boolean autostart)
BlockingSink to safely signal a target Subscriber or Processor.
 The subscriber will be immediately started only if the autostart property is true.  via
 Subscriber.onSubscribe(Subscription) as the
 result of
 this call.E - the reified Subscriber typesubscriber - the decorated Subscriberautostart - true if Subscriber.onSubscribe(Subscription) is invoked during this callBlockingSinkpublic static <E> BlockingSink<E> create(org.reactivestreams.Subscriber<? super E> subscriber)
BlockingSink to safely signal a target Subscriber or Processor.
 The actual will be immediately  started via Subscriber.onSubscribe(Subscription) as the result of
 this call.E - the reified Subscriber typesubscriber - the decorated SubscriberBlockingSinkpublic void cancel()
cancel in interface org.reactivestreams.Subscriptionpublic void close()
           throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic org.reactivestreams.Subscriber<? super E> downstream()
Producerdownstream in interface Producerpublic void next(E t)
t - the value to emit, not nulljava.lang.RuntimeException - the unchecked exception in case of error (eg.
 IllegalStateException if emission has failed)Subscriber.onNext(Object)public BlockingSink.Emission emit(E data)
Subscriber.onNext(Object) that will return a status 
 BlockingSink.Emission. The status will
 indicate if the decorated
 actual is backpressuring this BlockingSink and if it has previously been terminated successfully or
 not.data - the data to signalBlockingSink.Emission statuspublic void error(java.lang.Throwable error)
Subscriber.onError(Throwable) on the delegate
 Subscriber. This method might fail itself with an
 unchecked exception if an error has already been recorded or it
 has previously been terminated via cancel(), finish() or complete().error - the exception to signalpublic BlockingSink.Emission finish()
complete() to the decorated Subscriber. The completion might not return a
 successful BlockingSink.Emission.isOk() if this BlockingSink was previously terminated or the delegate
 failed consuming the signal.BlockingSink.Emission statuspublic long getCapacity()
TrackablegetCapacity in interface Trackablepublic java.lang.Throwable getError()
Trackablepublic boolean hasFailed()
BlockingSink has observed any errorpublic boolean hasRequested()
Subscriber is actively demandingpublic boolean isCancelled()
isCancelled in interface Trackablepublic void complete()
Subscriber.onComplete()public void request(long n)
request in interface org.reactivestreams.Subscriptionpublic long requestedFromDownstream()
TrackableSubscription request needs.
 This is the maximum in-flight data allowed to transit to this elements.requestedFromDownstream in interface Trackablepublic void start()
Subscriber.onSubscribe(Subscription). If called twice, the current BlockingSink might be
 cancelled as per Reactive Streams Specification enforce.public void stop()
public long submit(E data)
Subscriber.onNext(Object) call with an infinite wait on backpressure.data - the data to signalpublic long submit(E data, long timeout)
Subscriber.onNext(Object) call with a timed wait on backpressure.data - the data to signaltimeout - the maximum waiting time in milliseconds before giving uppublic long submit(E data, long timeout, java.util.function.Predicate<E> dropPredicate)
Subscriber.onNext(Object) call with a timed wait on backpressure. A retry predicate will
 evaluate when a timeout occurs, returning true will re-schedule an emission while false will drop the signal.data - the data to signaltimeout - the maximum waiting time in milliseconds before giving updropPredicate - the dropped signal callback evaluating if retry should occur or notpublic long submit(E data, long timeout, java.util.concurrent.TimeUnit unit)
Subscriber.onNext(Object) call with a timed wait on backpressure.data - the data to signaltimeout - the maximum waiting time in given unit before giving upunit - the waiting time unitpublic long submit(E data, long timeout, java.util.concurrent.TimeUnit unit, java.util.function.Predicate<E> dropPredicate)
Subscriber.onNext(Object) call with a timed wait on backpressure. A retry predicate will
 evaluate when a timeout occurs, returning true will re-schedule an emission while false will drop the signal.data - the data to signaltimeout - the maximum waiting time in given unit before giving upunit - the waiting time unitdropPredicate - the dropped signal callback evaluating if retry should occur or notpublic java.lang.String toString()
toString in class java.lang.Object