T
- the value typepublic final class BlockingMultiObserver<T> extends CountDownLatch implements SingleObserver<T>, CompletableObserver, MaybeObserver<T>
Constructor and Description |
---|
BlockingMultiObserver() |
Modifier and Type | Method and Description |
---|---|
boolean |
blockingAwait(long timeout,
TimeUnit unit)
Block until the observer terminates and return true; return false if
the wait times out.
|
T |
blockingGet()
Block until the latch is counted down then rethrow any exception received (wrapped if checked)
or return the received value (null if none).
|
T |
blockingGet(T defaultValue)
Block until the latch is counted down then rethrow any exception received (wrapped if checked)
or return the received value (the defaultValue if none).
|
Throwable |
blockingGetError()
Block until the latch is counted down and return the error received or null if no
error happened.
|
Throwable |
blockingGetError(long timeout,
TimeUnit unit)
Block until the latch is counted down and return the error received or
when the wait is interrupted or times out, null otherwise.
|
void |
onComplete()
Called once the deferred computation completes normally.
|
void |
onError(Throwable e)
Notifies the SingleObserver that the
Single has experienced an error condition. |
void |
onSubscribe(Disposable d)
Provides the SingleObserver with the means of cancelling (disposing) the
connection (channel) with the Single in both
synchronous (from within
onSubscribe(Disposable) itself) and asynchronous manner. |
void |
onSuccess(T value)
Notifies the SingleObserver with a single item and that the
Single has finished sending
push-based notifications. |
public void onSubscribe(Disposable d)
SingleObserver
onSubscribe(Disposable)
itself) and asynchronous manner.onSubscribe
in interface CompletableObserver
onSubscribe
in interface MaybeObserver<T>
onSubscribe
in interface SingleObserver<T>
d
- the Disposable instance whose Disposable.dispose()
can
be called anytime to cancel the connectionpublic void onSuccess(T value)
SingleObserver
Single
has finished sending
push-based notifications.
The Single
will not call this method if it calls SingleObserver.onError(java.lang.Throwable)
.
onSuccess
in interface MaybeObserver<T>
onSuccess
in interface SingleObserver<T>
value
- the item emitted by the Singlepublic void onError(Throwable e)
SingleObserver
Single
has experienced an error condition.
If the Single
calls this method, it will not thereafter call SingleObserver.onSuccess(T)
.
onError
in interface CompletableObserver
onError
in interface MaybeObserver<T>
onError
in interface SingleObserver<T>
e
- the exception encountered by the Singlepublic void onComplete()
CompletableObserver
onComplete
in interface CompletableObserver
onComplete
in interface MaybeObserver<T>
public T blockingGet()
public T blockingGet(T defaultValue)
defaultValue
- the default value to return if no value was receivedpublic Throwable blockingGetError()
public Throwable blockingGetError(long timeout, TimeUnit unit)
timeout
- the timeout valueunit
- the time unitpublic boolean blockingAwait(long timeout, TimeUnit unit)
timeout
- the timeout valueunit
- the time unitCopyright © 2018 JBoss by Red Hat. All rights reserved.