Package org.jboss.as.controller.remote
Class CompletedFuture<T>
- java.lang.Object
-
- org.jboss.as.controller.remote.CompletedFuture<T>
-
- All Implemented Interfaces:
Future<T>
,org.jboss.threads.AsyncCancellable
,org.jboss.threads.AsyncFuture<T>
public final class CompletedFuture<T> extends Object implements org.jboss.threads.AsyncFuture<T>
An AsyncFuture that is inAsyncFuture.Status.COMPLETE
as soon as it is instantiated.- Author:
- Brian Stansberry
-
-
Constructor Summary
Constructors Constructor Description CompletedFuture(T result)
Creates a future that will provide the given value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A> void
addListener(org.jboss.threads.AsyncFuture.Listener<? super T,A> listener, A attachment)
void
asyncCancel(boolean interruptionDesired)
org.jboss.threads.AsyncFuture.Status
await()
org.jboss.threads.AsyncFuture.Status
await(long timeout, TimeUnit unit)
org.jboss.threads.AsyncFuture.Status
awaitUninterruptibly()
org.jboss.threads.AsyncFuture.Status
awaitUninterruptibly(long timeout, TimeUnit unit)
boolean
cancel(boolean interruptionDesired)
T
get()
T
get(long timeout, TimeUnit unit)
org.jboss.threads.AsyncFuture.Status
getStatus()
T
getUninterruptibly()
T
getUninterruptibly(long timeout, TimeUnit unit)
boolean
isCancelled()
boolean
isDone()
-
-
-
Constructor Detail
-
CompletedFuture
public CompletedFuture(T result)
Creates a future that will provide the given value- Parameters:
result
- the value
-
-
Method Detail
-
await
public org.jboss.threads.AsyncFuture.Status await() throws InterruptedException
- Specified by:
await
in interfaceorg.jboss.threads.AsyncFuture<T>
- Throws:
InterruptedException
-
await
public org.jboss.threads.AsyncFuture.Status await(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
await
in interfaceorg.jboss.threads.AsyncFuture<T>
- Throws:
InterruptedException
-
getUninterruptibly
public T getUninterruptibly() throws CancellationException, ExecutionException
- Specified by:
getUninterruptibly
in interfaceorg.jboss.threads.AsyncFuture<T>
- Throws:
CancellationException
ExecutionException
-
getUninterruptibly
public T getUninterruptibly(long timeout, TimeUnit unit) throws CancellationException, ExecutionException, TimeoutException
- Specified by:
getUninterruptibly
in interfaceorg.jboss.threads.AsyncFuture<T>
- Throws:
CancellationException
ExecutionException
TimeoutException
-
awaitUninterruptibly
public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly()
- Specified by:
awaitUninterruptibly
in interfaceorg.jboss.threads.AsyncFuture<T>
-
awaitUninterruptibly
public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly(long timeout, TimeUnit unit)
- Specified by:
awaitUninterruptibly
in interfaceorg.jboss.threads.AsyncFuture<T>
-
getStatus
public org.jboss.threads.AsyncFuture.Status getStatus()
- Specified by:
getStatus
in interfaceorg.jboss.threads.AsyncFuture<T>
-
addListener
public <A> void addListener(org.jboss.threads.AsyncFuture.Listener<? super T,A> listener, A attachment)
- Specified by:
addListener
in interfaceorg.jboss.threads.AsyncFuture<T>
-
cancel
public boolean cancel(boolean interruptionDesired)
-
asyncCancel
public void asyncCancel(boolean interruptionDesired)
- Specified by:
asyncCancel
in interfaceorg.jboss.threads.AsyncCancellable
- Specified by:
asyncCancel
in interfaceorg.jboss.threads.AsyncFuture<T>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceFuture<T>
-
get
public T get() throws InterruptedException, ExecutionException
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
-