public interface Future<V> extends Future<V>
Modifier and Type | Method and 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.
|
boolean |
await(long timeoutMillis)
Waits for this future to be completed within the
specified time limit.
|
boolean |
await(long timeout,
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.
|
boolean |
awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
awaitUninterruptibly(long timeout,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
cancel(boolean mayInterruptIfRunning)
If the cancellation was successful it will fail the future with an
CancellationException . |
Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
V |
getNow()
Return the result without blocking.
|
boolean |
isCancellable()
returns
true if and only if the operation can be cancelled via cancel(boolean) . |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
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.
|
get, get, isCancelled, isDone
boolean isSuccess()
true
if and only if the I/O operation was completed
successfully.boolean isCancellable()
true
if and only if the operation can be cancelled via cancel(boolean)
.Throwable cause()
null
if succeeded or this future is not
completed yet.Future<V> addListener(GenericFutureListener<? extends Future<? super V>> listener)
Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Future<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener)
Future<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Future<V> sync() throws InterruptedException
InterruptedException
Future<V> syncUninterruptibly()
Future<V> await() throws InterruptedException
InterruptedException
- if the current thread was interruptedFuture<V> awaitUninterruptibly()
InterruptedException
and
discards it silently.boolean await(long timeout, TimeUnit unit) throws InterruptedException
true
if and only if the future was completed within
the specified time limitInterruptedException
- if the current thread was interruptedboolean await(long timeoutMillis) throws InterruptedException
true
if and only if the future was completed within
the specified time limitInterruptedException
- if the current thread was interruptedboolean awaitUninterruptibly(long timeout, TimeUnit unit)
InterruptedException
and discards it silently.true
if and only if the future was completed within
the specified time limitboolean awaitUninterruptibly(long timeoutMillis)
InterruptedException
and discards it silently.true
if and only if the future was completed within
the specified time limitV getNow()
null
.
As it is possible that a null
value is used to mark the future as successful you also need to check
if the future is really done with Future.isDone()
and not relay on the returned null
value.boolean cancel(boolean mayInterruptIfRunning)
CancellationException
.Copyright © 2008–2019 The Netty Project. All rights reserved.