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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
The failure fromonError(Throwable)
.void
void
void
void
take()
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
null
if either the stream is not done, or the stream completed successfully.
-
onSubscribe
- Specified by:
onSubscribe
in interfaceSubscriber<T>
-
onNext
- Specified by:
onNext
in interfaceSubscriber<T>
-
onError
- Specified by:
onError
in interfaceSubscriber<T>
-
onComplete
public void onComplete()- Specified by:
onComplete
in interfaceSubscriber<T>
-
take
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-