APIdia Launch Partner
Top Description Fields Constructors Methods
sun.nio.ch

pack-priv final Class CompletedFuture<V>

extends Object
implements Future<V>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Future
Imports
java.util.concurrent.Future, .TimeUnit, .ExecutionException, java.io.IOException

A Future representing the result of an I/O operation that has already completed.

Field Summary

Modifier and TypeField and Description
private final Throwable
private final V

Constructor Summary

AccessConstructor and Description
private
CompletedFuture(V result, Throwable exc)

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(boolean mayInterruptIfRunning)

Implements java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.

public V
get()

Implements java.util.concurrent.Future.get.

Waits if necessary for the computation to complete, and then retrieves its result.

public V
get(long timeout, TimeUnit unit)

Implements java.util.concurrent.Future.get.

Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

public boolean
isCancelled()

Implements java.util.concurrent.Future.isCancelled.

Returns true if this task was cancelled before it completed normally.

public boolean
isDone()

Implements java.util.concurrent.Future.isDone.

Returns true if this task completed.

pack-priv static <V> CompletedFuture<V>
pack-priv static <V> CompletedFuture<V>
withResult(V result)

pack-priv static <V> CompletedFuture<V>
withResult(V result, Throwable exc)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

excback to summary
private final Throwable exc
resultback to summary
private final V result

Constructor Detail

CompletedFutureback to summary
private CompletedFuture(V result, Throwable exc)

Method Detail

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Implements java.util.concurrent.Future.cancel.

Doc from java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task. This method has no effect if the task is already completed or cancelled, or could not be cancelled for some other reason. Otherwise, if this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task (when known by the implementation) is interrupted in an attempt to stop the task.

The return value from this method does not necessarily indicate whether the task is now cancelled; use isCancelled.

Annotations
@Override
getback to summary
public V get() throws ExecutionException

Implements java.util.concurrent.Future.get.

Doc from java.util.concurrent.Future.get.

Waits if necessary for the computation to complete, and then retrieves its result.

Annotations
@Override
Exceptions
ExecutionException:
if the computation threw an exception
getback to summary
public V get(long timeout, TimeUnit unit) throws ExecutionException

Implements java.util.concurrent.Future.get.

Doc from java.util.concurrent.Future.get.

Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Annotations
@Override
Exceptions
ExecutionException:
if the computation threw an exception
isCancelledback to summary
public boolean isCancelled()

Implements java.util.concurrent.Future.isCancelled.

Doc from java.util.concurrent.Future.isCancelled.

Returns true if this task was cancelled before it completed normally.

Annotations
@Override
isDoneback to summary
public boolean isDone()

Implements java.util.concurrent.Future.isDone.

Doc from java.util.concurrent.Future.isDone.

Returns true if this task completed. Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.

Annotations
@Override
withFailureback to summary
pack-priv static <V> CompletedFuture<V> withFailure(Throwable exc)
withResultback to summary
pack-priv static <V> CompletedFuture<V> withResult(V result)
withResultback to summary
pack-priv static <V> CompletedFuture<V> withResult(V result, Throwable exc)