org.apache.mina.common
Class WriteFuture

java.lang.Object
  extended by org.apache.mina.common.IoFuture
      extended by org.apache.mina.common.WriteFuture

public class WriteFuture
extends IoFuture

An IoFuture for asynchronous write requests.

Example

 IoSession session = ...;
 WriteFuture future = session.write(...);
 // Wait until the message is completely written out to the O/S buffer.
 future.join();
 if( future.isWritten() )
 {
     // The message has been written successfully.
 }
 else
 {
     // The messsage couldn't be written out completely for some reason.
     // (e.g. Connection is closed)
 }
 

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
 
Nested classes/interfaces inherited from class org.apache.mina.common.IoFuture
IoFuture.Callback
 
Constructor Summary
WriteFuture()
          Creates a new instance.
WriteFuture(Object lock)
          Creates a new instance which uses the specified object as a lock.
 
Method Summary
 boolean isWritten()
          Returns true if the write operation is finished successfully.
static WriteFuture newNotWrittenFuture()
          Returns a new WriteFuture which is already marked as 'not written'.
static WriteFuture newWrittenFuture()
          Returns a new WriteFuture which is already marked as 'written'.
 void setWritten(boolean written)
          This method is invoked by MINA internally.
 
Methods inherited from class org.apache.mina.common.IoFuture
getCallback, getLock, getValue, isReady, join, join, setCallback, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteFuture

public WriteFuture()
Creates a new instance.


WriteFuture

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

Method Detail

newWrittenFuture

public static WriteFuture newWrittenFuture()
Returns a new WriteFuture which is already marked as 'written'.


newNotWrittenFuture

public static WriteFuture newNotWrittenFuture()
Returns a new WriteFuture which is already marked as 'not written'.


isWritten

public boolean isWritten()
Returns true if the write operation is finished successfully.


setWritten

public void setWritten(boolean written)
This method is invoked by MINA internally. Please do not call this method directly.