Package one.nio.async
Class SettableFuture<V>
java.lang.Object
one.nio.async.SettableFuture<V>
- All Implemented Interfaces:
Runnable,Future<V>,RunnableFuture<V>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) get()booleanbooleanisDone()voidrun()voidvoidsetException(Throwable throwable) protected voidprotected voidwaitForCompletion(long timeout)
-
Field Details
-
value
-
throwable
-
done
protected volatile boolean done
-
-
Constructor Details
-
SettableFuture
public SettableFuture()
-
-
Method Details
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone() -
get
- 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
-
setException
-
waitForCompletion
- Throws:
InterruptedException
-
waitForCompletion
- Throws:
InterruptedExceptionTimeoutException
-
run
public void run()- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceRunnableFuture<V>
-