T
- the value typepublic final class FutureSingleObserver<T> extends CountDownLatch implements SingleObserver<T>, Future<T>, Disposable
Constructor and Description |
---|
FutureSingleObserver() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean mayInterruptIfRunning) |
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
boolean |
isDone() |
void |
onError(Throwable t)
Notifies the SingleObserver that the
Single has experienced an error condition. |
void |
onSubscribe(Disposable s)
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 t)
Notifies the SingleObserver with a single item and that the
Single has finished sending
push-based notifications. |
public boolean cancel(boolean mayInterruptIfRunning)
public boolean isCancelled()
isCancelled
in interface Future<T>
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
public void onSubscribe(Disposable s)
SingleObserver
onSubscribe(Disposable)
itself) and asynchronous manner.onSubscribe
in interface SingleObserver<T>
s
- the Disposable instance whose Disposable.dispose()
can
be called anytime to cancel the connectionpublic void onSuccess(T t)
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 SingleObserver<T>
t
- the item emitted by the Singlepublic void onError(Throwable t)
SingleObserver
Single
has experienced an error condition.
If the Single
calls this method, it will not thereafter call SingleObserver.onSuccess(T)
.
onError
in interface SingleObserver<T>
t
- the exception encountered by the Singlepublic void dispose()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
Disposable
isDisposed
in interface Disposable
Copyright © 2018 JBoss by Red Hat. All rights reserved.