org.apache.mina.common
Class IoFuture

java.lang.Object
  extended by org.apache.mina.common.IoFuture
Direct Known Subclasses:
CloseFuture, ConnectFuture, WriteFuture

public class IoFuture
extends Object

Represents the result of an ashynchronous I/O operation.

Version:
$Rev: 389042 $, $Date: 2006-03-27 16:49:41 +0900 (Mon, 27 Mar 2006) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Nested Class Summary
static interface IoFuture.Callback
          Something interested in being notified when the result of an IoFuture becomes available.
 
Constructor Summary
IoFuture()
          Creates a new instance.
IoFuture(Object lock)
          Creates a new instance which uses the specified object as a lock.
 
Method Summary
 IoFuture.Callback getCallback()
          Returns a IoFuture.Callback which is associated with this future.
 Object getLock()
          Returns the lock object this future acquires.
protected  Object getValue()
          Returns the result of the asynchronous operation.
 boolean isReady()
          Returns if the asynchronous operation is finished.
 void join()
          Wait for the asynchronous operation to end.
 boolean join(long timeoutInMillis)
          Wait for the asynchronous operation to end with the specified timeout.
 void setCallback(IoFuture.Callback callback)
          Sets a IoFuture.Callback to be notified when a result becomes available.
protected  void setValue(Object newValue)
          Sets the result of the asynchronous operation, and mark it as finished.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoFuture

public IoFuture()
Creates a new instance.


IoFuture

public IoFuture(Object lock)
Creates a new instance which uses the specified object as a lock.

Method Detail

getLock

public Object getLock()
Returns the lock object this future acquires.


join

public void join()
Wait for the asynchronous operation to end.


join

public boolean join(long timeoutInMillis)
Wait for the asynchronous operation to end with the specified timeout.

Returns:
true if the operation is finished.

isReady

public boolean isReady()
Returns if the asynchronous operation is finished.


setValue

protected void setValue(Object newValue)
Sets the result of the asynchronous operation, and mark it as finished.


getValue

protected Object getValue()
Returns the result of the asynchronous operation.


getCallback

public IoFuture.Callback getCallback()
Returns a IoFuture.Callback which is associated with this future.


setCallback

public void setCallback(IoFuture.Callback callback)
Sets a IoFuture.Callback to be notified when a result becomes available. If tth result has already become obtained, the specified callback is notified immediately