public class SignalRFuture<V>
extends java.lang.Object
implements java.util.concurrent.Future<V>
Constructor and Description |
---|
SignalRFuture() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the operation
|
boolean |
cancel(boolean mayInterruptIfRunning) |
SignalRFuture<V> |
done(Action<V> action)
Handles the completion of the Future.
|
boolean |
errorWasTriggered()
Indicates if an error was triggered
|
V |
get() |
V |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isCancelled()
Indicates if the operation is cancelled
|
boolean |
isDone() |
void |
onCancelled(java.lang.Runnable onCancelled)
Handles the cancellation event
|
SignalRFuture<V> |
onError(ErrorCallback errorCallback)
Handles error during the execution of the Future.
|
void |
setResult(V result)
Sets a result to the future and finishes its execution
|
void |
triggerError(java.lang.Throwable error)
Triggers an error for the Future
|
public void cancel()
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<V>
public SignalRFuture<V> done(Action<V> action)
action
- The handlerpublic boolean errorWasTriggered()
public V get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public V get(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<V>
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<V>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<V>
public void onCancelled(java.lang.Runnable onCancelled)
onCancelled
- The handlerpublic SignalRFuture<V> onError(ErrorCallback errorCallback)
errorCallback
- The handlerpublic void setResult(V result)
result
- The future resultpublic void triggerError(java.lang.Throwable error)
error
- The error