Package io.netty.util.concurrent
Class CompleteFuture<V>
- java.lang.Object
-
- io.netty.util.concurrent.AbstractFuture<V>
-
- io.netty.util.concurrent.CompleteFuture<V>
-
- All Implemented Interfaces:
Future<V>,java.util.concurrent.Future<V>
- Direct Known Subclasses:
FailedFuture,SucceededFuture
public abstract class CompleteFuture<V> extends AbstractFuture<V>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCompleteFuture(EventExecutor executor)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Future<V>addListener(GenericFutureListener<? extends Future<? super V>> listener)Adds the specified listener to this future.Future<V>addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)Adds the specified listeners to this future.Future<V>await()Waits for this future to be completed.booleanawait(long timeoutMillis)Waits for this future to be completed within the specified time limit.booleanawait(long timeout, java.util.concurrent.TimeUnit unit)Waits for this future to be completed within the specified time limit.Future<V>awaitUninterruptibly()Waits for this future to be completed without interruption.booleanawaitUninterruptibly(long timeoutMillis)Waits for this future to be completed within the specified time limit without interruption.booleanawaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)Waits for this future to be completed within the specified time limit without interruption.booleancancel(boolean mayInterruptIfRunning)If the cancellation was successful it will fail the future with aCancellationException.protected EventExecutorexecutor()Return theEventExecutorwhich is used by thisCompleteFuture.booleanisCancellable()returnstrueif and only if the operation can be cancelled viaFuture.cancel(boolean).booleanisCancelled()booleanisDone()Future<V>removeListener(GenericFutureListener<? extends Future<? super V>> listener)Removes the first occurrence of the specified listener from this future.Future<V>removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)Removes the first occurrence for each of the listeners from this future.Future<V>sync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.Future<V>syncUninterruptibly()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.-
Methods inherited from class io.netty.util.concurrent.AbstractFuture
get, get
-
-
-
-
Constructor Detail
-
CompleteFuture
protected CompleteFuture(EventExecutor executor)
Creates a new instance.- Parameters:
executor- theEventExecutorassociated with this future
-
-
Method Detail
-
executor
protected EventExecutor executor()
Return theEventExecutorwhich is used by thisCompleteFuture.
-
addListener
public Future<V> addListener(GenericFutureListener<? extends Future<? super V>> listener)
Description copied from interface:FutureAdds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.
-
addListeners
public Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Description copied from interface:FutureAdds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.
-
removeListener
public Future<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener)
Description copied from interface:FutureRemoves the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.
-
removeListeners
public Future<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Description copied from interface:FutureRemoves the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.
-
await
public Future<V> await() throws java.lang.InterruptedException
Description copied from interface:FutureWaits for this future to be completed.- Throws:
java.lang.InterruptedException- if the current thread was interrupted
-
await
public boolean await(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionDescription copied from interface:FutureWaits for this future to be completed within the specified time limit.- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
java.lang.InterruptedException- if the current thread was interrupted
-
sync
public Future<V> sync() throws java.lang.InterruptedException
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Throws:
java.lang.InterruptedException
-
syncUninterruptibly
public Future<V> syncUninterruptibly()
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
await
public boolean await(long timeoutMillis) throws java.lang.InterruptedExceptionDescription copied from interface:FutureWaits for this future to be completed within the specified time limit.- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
java.lang.InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
public Future<V> awaitUninterruptibly()
Description copied from interface:FutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently.
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeout, java.util.concurrent.TimeUnit unit)Description copied from interface:FutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Returns:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis)
Description copied from interface:FutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Returns:
trueif and only if the future was completed within the specified time limit
-
isDone
public boolean isDone()
-
isCancellable
public boolean isCancellable()
Description copied from interface:Futurereturnstrueif and only if the operation can be cancelled viaFuture.cancel(boolean).
-
isCancelled
public boolean isCancelled()
-
cancel
public boolean cancel(boolean mayInterruptIfRunning)
If the cancellation was successful it will fail the future with aCancellationException.- Parameters:
mayInterruptIfRunning- this value has no effect in this implementation.
-
-