org.glassfish.grizzly.impl
Class ReadyFutureImpl<R>

java.lang.Object
  extended by org.glassfish.grizzly.impl.ReadyFutureImpl<R>
All Implemented Interfaces:
Future<R>

public class ReadyFutureImpl<R>
extends Object
implements Future<R>

Future implementation with the specific unmodifiable result.

Author:
Alexey Stashok
See Also:
Future

Field Summary
protected  R result
           
 
Constructor Summary
  ReadyFutureImpl()
          Construct cancelled Future.
  ReadyFutureImpl(R result)
          Construct Future with the result.
protected ReadyFutureImpl(R result, Throwable failure, boolean isCancelled)
           
  ReadyFutureImpl(Throwable failure)
          Construct failed Future.
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Do nothing.
 void failure(Throwable failure)
          Should not be called for ReadyFutureImpl
 R get()
          
 R get(long timeout, TimeUnit unit)
          
 R getResult()
          Get current result value without any blocking.
 boolean isCancelled()
          
 boolean isDone()
          
 void setResult(R result)
          Should not be called for ReadyFutureImpl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

result

protected final R result
Constructor Detail

ReadyFutureImpl

public ReadyFutureImpl()
Construct cancelled Future.


ReadyFutureImpl

public ReadyFutureImpl(R result)
Construct Future with the result.


ReadyFutureImpl

public ReadyFutureImpl(Throwable failure)
Construct failed Future.


ReadyFutureImpl

protected ReadyFutureImpl(R result,
                          Throwable failure,
                          boolean isCancelled)
Method Detail

getResult

public R getResult()
Get current result value without any blocking.

Returns:
current result value without any blocking.

setResult

public void setResult(R result)
Should not be called for ReadyFutureImpl


cancel

public boolean cancel(boolean mayInterruptIfRunning)
Do nothing.

Specified by:
cancel in interface Future<R>
Returns:
cancel state, which was set during construction.

isCancelled

public boolean isCancelled()

Specified by:
isCancelled in interface Future<R>

isDone

public boolean isDone()

Specified by:
isDone in interface Future<R>

get

public R get()
      throws InterruptedException,
             ExecutionException

Specified by:
get in interface Future<R>
Throws:
InterruptedException
ExecutionException

get

public R get(long timeout,
             TimeUnit unit)
      throws InterruptedException,
             ExecutionException,
             TimeoutException

Specified by:
get in interface Future<R>
Throws:
InterruptedException
ExecutionException
TimeoutException

failure

public void failure(Throwable failure)
Should not be called for ReadyFutureImpl



Copyright © 2009 SUN Microsystems. All Rights Reserved.