Package io.micronaut.http.netty
Class PublisherAsBlocking<T>
java.lang.Object
io.micronaut.http.netty.PublisherAsBlocking<T>
- Type Parameters:
T- Stream type
- All Implemented Interfaces:
Closeable,AutoCloseable,Subscriber<T>
@Internal
public final class PublisherAsBlocking<T>
extends Object
implements Subscriber<T>, Closeable
A subscriber that allows blocking reads from a publisher. Handles resource cleanup properly.
- Since:
- 4.2.0
- Author:
- Jonas Konrad
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()The failure fromonError(Throwable).voidvoidvoidvoidtake()Get the next object.
-
Constructor Details
-
PublisherAsBlocking
public PublisherAsBlocking()
-
-
Method Details
-
getFailure
The failure fromonError(Throwable). Whentake()returnsnull, this may be set if the reactive stream ended in failure.- Returns:
- The failure, or
nullif either the stream is not done, or the stream completed successfully.
-
onSubscribe
- Specified by:
onSubscribein interfaceSubscriber<T>
-
onNext
- Specified by:
onNextin interfaceSubscriber<T>
-
onError
- Specified by:
onErrorin interfaceSubscriber<T>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceSubscriber<T>
-
take
Get the next object.- Returns:
- The next object, or
nullif the stream is done - Throws:
InterruptedException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-