T - The type of the result returned by the target task.public final class FutureCanceller<T> extends TimerTask implements com.google.common.util.concurrent.FutureCallback<T>
Runnable that cancels the task associated with
the given ListenableFuture instance.| Modifier and Type | Method and Description |
|---|---|
void |
onFailure(Throwable cause)
Invoked when the taret task has failed.
|
void |
onSuccess(T result)
Invoked when the target task has successfully completed.
|
void |
run()
Cancel the specified task.
|
static <T> void |
set(Timer timer,
long timeout,
com.google.common.util.concurrent.ListenableFuture<T> f)
Set a future canceller that cancels the given future without
interrupting the thread.
|
static <T> void |
set(Timer timer,
long timeout,
com.google.common.util.concurrent.ListenableFuture<T> f,
boolean intr)
Set a future canceller that cancels the given future.
|
cancel, scheduledExecutionTimepublic static <T> void set(Timer timer, long timeout, com.google.common.util.concurrent.ListenableFuture<T> f)
T - The type of the result returned by the target task.timer - A Timer instance to execute the timer.timeout - The number of milliseconds to wait for completion of
the target task.f - A ListenableFuture instance associated with the
task to wait.public static <T> void set(Timer timer, long timeout, com.google.common.util.concurrent.ListenableFuture<T> f, boolean intr)
T - The type of the result returned by the target task.timer - A Timer instance to execute the timer.timeout - The number of milliseconds to wait for completion of
the target task.f - A ListenableFuture instance associated with the
task to wait.intr - true if the task runner thread should be
interrupted. Otherwise in-progress task are allowed
to complete.public void run()
public void onSuccess(T result)
This method only cancels this timer task.
onSuccess in interface com.google.common.util.concurrent.FutureCallback<T>result - The result of the target task.Copyright © 2018 OpenDaylight. All rights reserved.