mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r545118 - in /mina/trunk/core/src: main/java/org/apache/mina/common/ main/java/org/apache/mina/common/support/ test/java/org/apache/mina/filter/
Date Thu, 07 Jun 2007 09:17:23 GMT
Author: trustin
Date: Thu Jun  7 02:17:21 2007
New Revision: 545118

URL: http://svn.apache.org/viewvc?view=rev&rev=545118
Log:
Related issue: DIRMINA-380 (Invocation chaining for IoFuture)
* Applied invocation chanining to IoFuture and its subtypes

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/common/CloseFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/ConnectFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/DefaultWriteRequest.java
    mina/trunk/core/src/main/java/org/apache/mina/common/IoFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/WriteFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultCloseFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultConnectFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultIoFuture.java
    mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultWriteFuture.java
    mina/trunk/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/CloseFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/CloseFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/CloseFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/CloseFuture.java Thu Jun  7 02:17:21
2007
@@ -48,4 +48,9 @@
      * this method directly.
      */
     void setClosed();
+    
+    CloseFuture await() throws InterruptedException;
+    CloseFuture awaitUninterruptibly();
+    CloseFuture addListener( IoFutureListener listener );
+    CloseFuture removeListener( IoFutureListener listener );
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/ConnectFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/ConnectFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/ConnectFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/ConnectFuture.java Thu Jun  7 02:17:21
2007
@@ -70,4 +70,9 @@
      * internally.  Please do not call this method directly.
      */
     void setException( Throwable exception );
+
+    ConnectFuture await() throws InterruptedException;
+    ConnectFuture awaitUninterruptibly();
+    ConnectFuture addListener( IoFutureListener listener );
+    ConnectFuture removeListener( IoFutureListener listener );
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/DefaultWriteRequest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/DefaultWriteRequest.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/DefaultWriteRequest.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/DefaultWriteRequest.java Thu Jun
 7 02:17:21 2007
@@ -60,17 +60,18 @@
             return true;
         }
 
-        public void addListener( IoFutureListener listener )
+        public WriteFuture addListener( IoFutureListener listener )
         {
             throw new IllegalStateException( "You can't add a listener to a dummy future."
);
         }
 
-        public void removeListener( IoFutureListener listener )
+        public WriteFuture removeListener( IoFutureListener listener )
         {
             throw new IllegalStateException( "You can't add a listener to a dummy future."
);
         }
 
-        public void await() throws InterruptedException {
+        public WriteFuture await() throws InterruptedException {
+            return this;
         }
 
         public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
@@ -81,7 +82,8 @@
             return true;
         }
 
-        public void awaitUninterruptibly() {
+        public WriteFuture awaitUninterruptibly() {
+            return this;
         }
 
         public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/IoFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/IoFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/IoFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/IoFuture.java Thu Jun  7 02:17:21
2007
@@ -38,7 +38,7 @@
     /**
      * Wait for the asynchronous operation to end.
      */
-    void await() throws InterruptedException;
+    IoFuture await() throws InterruptedException;
 
     /**
      * Wait for the asynchronous operation to end with the specified timeout.
@@ -57,7 +57,7 @@
     /**
      * Wait for the asynchronous operation to end uninterruptibly.
      */
-    void awaitUninterruptibly();
+    IoFuture awaitUninterruptibly();
 
     /**
      * Wait for the asynchronous operation to end with the specified timeout
@@ -96,11 +96,11 @@
      * Adds an event <tt>listener</tt> which is notified when
      * the state of this future changes.
      */
-    void addListener( IoFutureListener listener );
+    IoFuture addListener( IoFutureListener listener );
     
     /**
      * Removes an existing event <tt>listener</tt> which is notified when
      * the state of this future changes.
      */
-    void removeListener( IoFutureListener listener );
+    IoFuture removeListener( IoFutureListener listener );
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/WriteFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/WriteFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/WriteFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/WriteFuture.java Thu Jun  7 02:17:21
2007
@@ -55,4 +55,9 @@
      * Please do not call this method directly.
      */
     void setWritten( boolean written );
+
+    WriteFuture await() throws InterruptedException;
+    WriteFuture awaitUninterruptibly();
+    WriteFuture addListener( IoFutureListener listener );
+    WriteFuture removeListener( IoFutureListener listener );
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultCloseFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultCloseFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultCloseFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultCloseFuture.java Thu
Jun  7 02:17:21 2007
@@ -20,6 +20,7 @@
 package org.apache.mina.common.support;
 
 import org.apache.mina.common.CloseFuture;
+import org.apache.mina.common.IoFutureListener;
 import org.apache.mina.common.IoSession;
 
 /**
@@ -53,5 +54,25 @@
     public void setClosed()
     {
         setValue( Boolean.TRUE );
+    }
+
+    @Override
+    public CloseFuture await() throws InterruptedException {
+        return (CloseFuture) super.await();
+    }
+    
+    @Override
+    public CloseFuture awaitUninterruptibly() {
+        return (CloseFuture) super.awaitUninterruptibly();
+    }
+    
+    @Override
+    public CloseFuture addListener(IoFutureListener listener) {
+        return (CloseFuture) super.addListener(listener);
+    }
+    
+    @Override
+    public CloseFuture removeListener(IoFutureListener listener) {
+        return (CloseFuture) super.removeListener(listener);
     }
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultConnectFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultConnectFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultConnectFuture.java
(original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultConnectFuture.java
Thu Jun  7 02:17:21 2007
@@ -20,6 +20,7 @@
 package org.apache.mina.common.support;
 
 import org.apache.mina.common.ConnectFuture;
+import org.apache.mina.common.IoFutureListener;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.RuntimeIOException;
 
@@ -93,5 +94,25 @@
     public void setException( Throwable exception )
     {
         setValue( exception );
+    }
+
+    @Override
+    public ConnectFuture await() throws InterruptedException {
+        return (ConnectFuture) super.await();
+    }
+    
+    @Override
+    public ConnectFuture awaitUninterruptibly() {
+        return (ConnectFuture) super.awaitUninterruptibly();
+    }
+    
+    @Override
+    public ConnectFuture addListener(IoFutureListener listener) {
+        return (ConnectFuture) super.addListener(listener);
+    }
+    
+    @Override
+    public ConnectFuture removeListener(IoFutureListener listener) {
+        return (ConnectFuture) super.removeListener(listener);
     }
 }

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultIoFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultIoFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultIoFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultIoFuture.java Thu
Jun  7 02:17:21 2007
@@ -65,7 +65,7 @@
         return awaitUninterruptibly(timeoutMillis);
     }
     
-    public void await() throws InterruptedException {
+    public IoFuture await() throws InterruptedException {
         synchronized( lock )
         {
             while( !ready )
@@ -73,6 +73,7 @@
                 lock.wait();
             }
         }
+        return this;
     }
     
     public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
@@ -90,7 +91,7 @@
         }
     }
     
-    public void awaitUninterruptibly()
+    public IoFuture awaitUninterruptibly()
     {
         synchronized( lock )
         {
@@ -105,6 +106,8 @@
                 }
             }
         }
+        
+        return this;
     }
     
     public boolean awaitUninterruptibly( long timeout, TimeUnit unit) {
@@ -192,7 +195,7 @@
         }
     }
     
-    public void addListener( IoFutureListener listener )
+    public IoFuture addListener( IoFutureListener listener )
     {
         if( listener == null )
         {
@@ -207,9 +210,11 @@
                 listener.operationComplete( this );
             }
         }
+        
+        return this;
     }
     
-    public void removeListener( IoFutureListener listener )
+    public IoFuture removeListener( IoFutureListener listener )
     {
         if( listener == null )
         {
@@ -220,6 +225,8 @@
         {
             listeners.remove( listener );
         }
+        
+        return this;
     }
 
     private void notifyListeners()

Modified: mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultWriteFuture.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultWriteFuture.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultWriteFuture.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/common/support/DefaultWriteFuture.java Thu
Jun  7 02:17:21 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.mina.common.support;
 
+import org.apache.mina.common.IoFutureListener;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.WriteFuture;
 
@@ -73,5 +74,25 @@
     public void setWritten( boolean written )
     {
         setValue( written? Boolean.TRUE : Boolean.FALSE );
+    }
+
+    @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);
     }
 }

Modified: mina/trunk/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java?view=diff&rev=545118&r1=545117&r2=545118
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java Thu Jun
 7 02:17:21 2007
@@ -640,16 +640,18 @@
             return true;
         }
 
-        public void addListener( IoFutureListener listener )
+        public WriteFuture addListener( IoFutureListener listener )
         {
+            return this;
         }
 
-        public void removeListener( IoFutureListener listener )
+        public WriteFuture removeListener( IoFutureListener listener )
         {
+            return this;
         }
 
-        public void await() throws InterruptedException {
-            
+        public WriteFuture await() throws InterruptedException {
+            return this;
         }
 
         public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
@@ -660,7 +662,8 @@
             return true;
         }
 
-        public void awaitUninterruptibly() {
+        public WriteFuture awaitUninterruptibly() {
+            return this;
         }
 
         public boolean awaitUninterruptibly(long timeout, TimeUnit unit) {



Mime
View raw message