Package io.netty.util.concurrent
Class CompleteFuture<V>
java.lang.Object
io.netty.util.concurrent.AbstractFuture<V>
io.netty.util.concurrent.CompleteFuture<V>
- Direct Known Subclasses:
CompleteChannelFuture,FailedFuture,SucceededFuture
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCompleteFuture(EventExecutor executor) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionaddListener(GenericFutureListener<? extends Future<? super V>> listener) Adds the specified listener to this future.addListeners(GenericFutureListener<? extends Future<? super V>>... listeners) Adds the specified listeners to this future.await()Waits for this future to be completed.booleanawait(long timeoutMillis) Waits for this future to be completed within the specified time limit.booleanWaits for this future to be completed within the specified time limit.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, 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.booleanreturnstrueif and only if the operation can be cancelled viaFuture.cancel(boolean).booleanbooleanisDone()removeListener(GenericFutureListener<? extends Future<? super V>> listener) Removes the first occurrence of the specified listener from this future.removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners) Removes the first occurrence for each of the listeners from this future.sync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.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, getMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
executor
-
-
Constructor Details
-
CompleteFuture
Creates a new instance.- Parameters:
executor- theEventExecutorassociated with this future
-
-
Method Details
-
executor
Return theEventExecutorwhich is used by thisCompleteFuture. -
addListener
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
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
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
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
Description copied from interface:FutureWaits for this future to be completed.- Throws:
InterruptedException- if the current thread was interrupted
-
await
Description 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:
InterruptedException- if the current thread was interrupted
-
sync
Description copied from interface:FutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed.- Throws:
InterruptedException
-
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
Description 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:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Description copied from interface:FutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently. -
awaitUninterruptibly
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.
-