Class PublisherAsBlocking<T>

java.lang.Object
io.micronaut.http.netty.PublisherAsBlocking<T>
Type Parameters:
T - Stream type
All Implemented Interfaces:
Closeable, AutoCloseable, org.reactivestreams.Subscriber<T>

@Internal public final class PublisherAsBlocking<T> extends Object implements org.reactivestreams.Subscriber<T>, Closeable
A subscriber that allows blocking reads from a publisher. Handles resource cleanup properly.
Since:
4.2.0
  • Constructor Details

    • PublisherAsBlocking

      public PublisherAsBlocking()
  • Method Details

    • getFailure

      @Nullable public @Nullable Throwable getFailure()
      The failure from onError(Throwable). When take() returns null, this may be set if the reactive stream ended in failure.
      Returns:
      The failure, or null if either the stream is not done, or the stream completed successfully.
    • onSubscribe

      public void onSubscribe(org.reactivestreams.Subscription s)
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<T>
    • onNext

      public void onNext(T o)
      Specified by:
      onNext in interface org.reactivestreams.Subscriber<T>
    • onError

      public void onError(Throwable t)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<T>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<T>
    • take

      @Nullable public T take() throws InterruptedException
      Get the next object.
      Returns:
      The next object, or null if the stream is done
      Throws:
      InterruptedException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable