org.apache.mina.common
Class DefaultWriteFuture

java.lang.Object
  extended by org.apache.mina.common.DefaultIoFuture
      extended by org.apache.mina.common.DefaultWriteFuture
All Implemented Interfaces:
IoFuture, WriteFuture

public class DefaultWriteFuture
extends DefaultIoFuture
implements WriteFuture

A default implementation of WriteFuture.

Version:
$Rev: 599745 $, $Date: 2007-11-30 10:04:47 +0100 (Fri, 30 Nov 2007) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
DefaultWriteFuture(IoSession session)
          Creates a new instance.
 
Method Summary
 WriteFuture addListener(IoFutureListener<?> listener)
          Adds an event listener which is notified when the state of this future changes.
 WriteFuture await()
          Wait for the asynchronous operation to end.
 WriteFuture awaitUninterruptibly()
          Wait for the asynchronous operation to end uninterruptibly.
 Throwable getException()
          Returns the cause of the write failure if and only if the write operation has failed due to an Exception.
 boolean isWritten()
          Returns true if the write operation is finished successfully.
static WriteFuture newNotWrittenFuture(IoSession session, Throwable cause)
          Returns a new DefaultWriteFuture which is already marked as 'not written'.
static WriteFuture newWrittenFuture(IoSession session)
          Returns a new DefaultWriteFuture which is already marked as 'written'.
 WriteFuture removeListener(IoFutureListener<?> listener)
          Removes an existing event listener which is notified when the state of this future changes.
 void setException(Throwable exception)
          Sets the cause of the write failure, and notifies all threads waiting for this future.
 void setWritten()
          Sets the message is written, and notifies all threads waiting for this future.
 
Methods inherited from class org.apache.mina.common.DefaultIoFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, getValue, isReady, join, join, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoFuture
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isReady, join, join
 

Constructor Detail

DefaultWriteFuture

public DefaultWriteFuture(IoSession session)
Creates a new instance.

Method Detail

newWrittenFuture

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


newNotWrittenFuture

public static WriteFuture newNotWrittenFuture(IoSession session,
                                              Throwable cause)
Returns a new DefaultWriteFuture which is already marked as 'not written'.


isWritten

public boolean isWritten()
Description copied from interface: WriteFuture
Returns true if the write operation is finished successfully.

Specified by:
isWritten in interface WriteFuture

getException

public Throwable getException()
Description copied from interface: WriteFuture
Returns the cause of the write failure if and only if the write operation has failed due to an Exception. Otherwise, null is returned.

Specified by:
getException in interface WriteFuture

setWritten

public void setWritten()
Description copied from interface: WriteFuture
Sets the message is written, and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.

Specified by:
setWritten in interface WriteFuture

setException

public void setException(Throwable exception)
Description copied from interface: WriteFuture
Sets the cause of the write failure, and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.

Specified by:
setException in interface WriteFuture

await

public WriteFuture await()
                  throws InterruptedException
Description copied from interface: IoFuture
Wait for the asynchronous operation to end.

Specified by:
await in interface IoFuture
Specified by:
await in interface WriteFuture
Overrides:
await in class DefaultIoFuture
Throws:
InterruptedException

awaitUninterruptibly

public WriteFuture awaitUninterruptibly()
Description copied from interface: IoFuture
Wait for the asynchronous operation to end uninterruptibly.

Specified by:
awaitUninterruptibly in interface IoFuture
Specified by:
awaitUninterruptibly in interface WriteFuture
Overrides:
awaitUninterruptibly in class DefaultIoFuture

addListener

public WriteFuture addListener(IoFutureListener<?> listener)
Description copied from interface: IoFuture
Adds an event listener which is notified when the state of this future changes.

Specified by:
addListener in interface IoFuture
Specified by:
addListener in interface WriteFuture
Overrides:
addListener in class DefaultIoFuture

removeListener

public WriteFuture removeListener(IoFutureListener<?> listener)
Description copied from interface: IoFuture
Removes an existing event listener which is notified when the state of this future changes.

Specified by:
removeListener in interface IoFuture
Specified by:
removeListener in interface WriteFuture
Overrides:
removeListener in class DefaultIoFuture


Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.