public final class CompletedFuture<T> extends Object implements org.jboss.threads.AsyncFuture<T>
AsyncFuture.Status.COMPLETE
as soon as it is instantiated.Constructor and Description |
---|
CompletedFuture(T result)
Creates a future that will provide the given value
|
Modifier and Type | Method and 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() |
public CompletedFuture(T result)
result
- the valuepublic org.jboss.threads.AsyncFuture.Status await() throws InterruptedException
await
in interface org.jboss.threads.AsyncFuture<T>
InterruptedException
public org.jboss.threads.AsyncFuture.Status await(long timeout, TimeUnit unit) throws InterruptedException
await
in interface org.jboss.threads.AsyncFuture<T>
InterruptedException
public T getUninterruptibly() throws CancellationException, ExecutionException
getUninterruptibly
in interface org.jboss.threads.AsyncFuture<T>
CancellationException
ExecutionException
public T getUninterruptibly(long timeout, TimeUnit unit) throws CancellationException, ExecutionException, TimeoutException
getUninterruptibly
in interface org.jboss.threads.AsyncFuture<T>
CancellationException
ExecutionException
TimeoutException
public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly()
awaitUninterruptibly
in interface org.jboss.threads.AsyncFuture<T>
public org.jboss.threads.AsyncFuture.Status awaitUninterruptibly(long timeout, TimeUnit unit)
awaitUninterruptibly
in interface org.jboss.threads.AsyncFuture<T>
public org.jboss.threads.AsyncFuture.Status getStatus()
getStatus
in interface org.jboss.threads.AsyncFuture<T>
public <A> void addListener(org.jboss.threads.AsyncFuture.Listener<? super T,A> listener, A attachment)
addListener
in interface org.jboss.threads.AsyncFuture<T>
public boolean cancel(boolean interruptionDesired)
public void asyncCancel(boolean interruptionDesired)
asyncCancel
in interface org.jboss.threads.AsyncCancellable
asyncCancel
in interface org.jboss.threads.AsyncFuture<T>
public boolean isCancelled()
isCancelled
in interface Future<T>
public T get() throws InterruptedException, ExecutionException
get
in interface Future<T>
InterruptedException
ExecutionException
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get
in interface Future<T>
InterruptedException
ExecutionException
TimeoutException
Copyright © 2023 JBoss by Red Hat. All rights reserved.