Package one.nio.async
Class SettableFuture<V>
- java.lang.Object
-
- one.nio.async.SettableFuture<V>
-
- All Implemented Interfaces:
Runnable,Future<V>,RunnableFuture<V>
public class SettableFuture<V> extends Object implements RunnableFuture<V>
-
-
Constructor Summary
Constructors Constructor Description SettableFuture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancel(boolean mayInterruptIfRunning)Vget()Vget(long timeout, TimeUnit unit)booleanisCancelled()booleanisDone()voidrun()voidset(V value)voidsetException(Throwable throwable)protected voidwaitForCompletion()protected voidwaitForCompletion(long timeout)
-
-
-
Method Detail
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfaceFuture<V>
-
get
public V get() throws InterruptedException, ExecutionException
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionException
-
get
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
getin interfaceFuture<V>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
set
public void set(V value)
-
setException
public void setException(Throwable throwable)
-
waitForCompletion
protected void waitForCompletion() throws InterruptedException- Throws:
InterruptedException
-
waitForCompletion
protected void waitForCompletion(long timeout) throws InterruptedException, TimeoutException- Throws:
InterruptedExceptionTimeoutException
-
run
public void run()
- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<V>
-
-