/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 *
 */
package org.apache.mina.common;


/**
 * A default implementation of {@link WriteFuture}.
 *
 * @author The Apache MINA Project (dev@mina.apache.org)
 * @version $Rev$, $Date$
 */
public class DefaultWriteFuture extends DefaultIoFuture implements WriteFuture {
    /**
     * Returns a new {@link DefaultWriteFuture} which is already marked as 'written'.
     */
    public static WriteFuture newWrittenFuture(IoSession session) {
        DefaultWriteFuture unwrittenFuture = new DefaultWriteFuture(session);
        unwrittenFuture.setWritten();
        return unwrittenFuture;
    }

    /**
     * Returns a new {@link DefaultWriteFuture} which is already marked as 'not written'.
     */
    public static WriteFuture newNotWrittenFuture(IoSession session, Throwable cause) {
        DefaultWriteFuture unwrittenFuture = new DefaultWriteFuture(session);
        unwrittenFuture.setException(cause);
        return unwrittenFuture;
    }

    /**
     * Creates a new instance.
     */
    public DefaultWriteFuture(IoSession session) {
        super(session);
    }

    public boolean isWritten() {
        if (isReady()) {
            Object v = getValue();
            if (v instanceof Boolean) {
                return ((Boolean) v).booleanValue();
            }
        }
        return false;
    }
    
    public Throwable getException() {
        if (isReady()) {
            Object v = getValue();
            if (v instanceof Throwable) {
                return (Throwable) v;
            }
        }
        return null;
    }

    public void setWritten() {
        setValue(Boolean.TRUE);
    }
    
    public void setException(Throwable exception) {
        if (exception == null) {
            throw new NullPointerException("exception");
        }
        
        setValue(exception);
    }

    @Override
    public WriteFuture await() throws InterruptedException {
        return (WriteFuture) super.await();
    }

    @Override
    public WriteFuture awaitUninterruptibly() {
        return (WriteFuture) super.awaitUninterruptibly();
    }

    @Override
    public WriteFuture addListener(IoFutureListener<?> listener) {
        return (WriteFuture) super.addListener(listener);
    }

    @Override
    public WriteFuture removeListener(IoFutureListener<?> listener) {
        return (WriteFuture) super.removeListener(listener);
    }
}

@@ -1881,32 +1881,69 @@
 ession);%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     public boole
@@ -1951,32 +1951,32 @@
 n isWritten() %7B%0A
-
         if (isRe
@@ -2161,32 +2161,69 @@
 lse;%0A    %7D%0A    %0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     public Throw
@@ -2432,24 +2432,61 @@
 ull;%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     public v
@@ -2543,24 +2543,61 @@
 %0A    %7D%0A    %0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     public v
@@ -2773,32 +2773,69 @@
 eption);%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     @Override%0A  
@@ -2936,32 +2936,69 @@
 await();%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     @Override%0A  
@@ -3101,32 +3101,69 @@
 tibly();%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     @Override%0A  
@@ -3288,24 +3288,61 @@
 er);%0A    %7D%0A%0A
+    /**%0A     * %7B@inheritDoc%7D%0A     */%0A
     @Overrid

Add some missing Javadoc tag