directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r442102 - in /directory/trunks/mina/core/src: main/java/org/apache/mina/common/ main/java/org/apache/mina/common/support/ main/java/org/apache/mina/transport/socket/nio/ main/java/org/apache/mina/transport/socket/nio/support/ main/java/org/...
Date Mon, 11 Sep 2006 05:11:59 GMT
Author: trustin
Date: Sun Sep 10 22:11:58 2006
New Revision: 442102

URL: http://svn.apache.org/viewvc?view=rev&rev=442102
Log:
Publicized event firing methods in IoFilterChain

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoFilterChain.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/AbstractIoFilterChain.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeIdleStatusChecker.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoFilterChain.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoFilterChain.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoFilterChain.java (original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoFilterChain.java Sun
Sep 10 22:11:58 2006
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.mina.common.IoFilter.NextFilter;
+import org.apache.mina.common.IoFilter.WriteRequest;
 
 /**
  * A container of {@link IoFilter}s that forwards {@link IoHandler} events
@@ -131,6 +132,69 @@
      * @throws Exception if {@link IoFilter#onPostRemove(IoFilterChain, String, NextFilter)}
thrown an exception.
      */
     void clear() throws Exception;
+
+    /**
+     * Fires a {@link IoHandler#sessionCreated(IoSession)} event.  Most users don't need
to
+     * call this method at all.  Please use this method only when you implement a new transport
+     * or fire a virtual event.
+     */
+    public void fireSessionCreated( IoSession session );
+
+    /**
+     * Fires a {@link IoHandler#sessionOpened(IoSession)} event.  Most users don't need to
call
+     * this method at all.  Please use this method only when you implement a new transport
or
+     * fire a virtual event.
+     */
+    public void fireSessionOpened( IoSession session );
+
+    /**
+     * Fires a {@link IoHandler#sessionClosed(IoSession)} event.  Most users don't need to
call
+     * this method at all.  Please use this method only when you implement a new transport
or
+     * fire a virtual event.
+     */
+    public void fireSessionClosed( IoSession session );
+
+    /**
+     * Fires a {@link IoHandler#sessionIdle(IoSession, IdleStatus)} event.  Most users don't
+     * need to call this method at all.  Please use this method only when you implement a
new
+     * transport or fire a virtual event.
+     */
+    public void fireSessionIdle( IoSession session, IdleStatus status );
+
+    /**
+     * Fires a {@link #fireMessageReceived(IoSession, Object)} event.  Most users don't need
to
+     * call this method at all.  Please use this method only when you implement a new transport
+     * or fire a virtual event.
+     */
+    public void fireMessageReceived( IoSession session, Object message );
+
+    /**
+     * Fires a {@link IoHandler#sessionOpened(IoSession)} event.  Most users don't need to
call
+     * this method at all.  Please use this method only when you implement a new transport
or
+     * fire a virtual event.
+     */
+    public void fireMessageSent( IoSession session, WriteRequest request );
+
+    /**
+     * Fires a {@link IoHandler#exceptionCaught(IoSession, Throwable)} event.  Most users
don't
+     * need to call this method at all.  Please use this method only when you implement a
new
+     * transport or fire a virtual event.
+     */
+    public void fireExceptionCaught( IoSession session, Throwable cause );
+
+    /**
+     * Fires a {@link IoSession#write(Object)} event.  Most users don't need to call this
+     * method at all.  Please use this method only when you implement a new transport or
fire a
+     * virtual event.
+     */
+    public void fireFilterWrite( IoSession session, WriteRequest writeRequest );
+
+    /**
+     * Fires a {@link IoSession#close()} event.  Most users don't need to call this method
at
+     * all.  Please use this method only when you implement a new transport or fire a virtual
+     * event.
+     */
+    public void fireFilterClose( IoSession session );
     
     /**
      * Represents a name-filter pair that an {@link IoFilterChain} contains.

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/AbstractIoFilterChain.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/AbstractIoFilterChain.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/AbstractIoFilterChain.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/AbstractIoFilterChain.java
Sun Sep 10 22:11:58 2006
@@ -399,7 +399,7 @@
         }
     }
 
-    public void sessionCreated( IoSession session )
+    public void fireSessionCreated( IoSession session )
     {
         Entry head = this.head;
         callNextSessionCreated(head, session);
@@ -413,11 +413,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void sessionOpened( IoSession session )
+    public void fireSessionOpened( IoSession session )
     {
         Entry head = this.head;
         callNextSessionOpened(head, session);
@@ -432,11 +432,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void sessionClosed( IoSession session )
+    public void fireSessionClosed( IoSession session )
     {
         // Update future.
         try
@@ -445,7 +445,7 @@
         }
         catch( Throwable t )
         {
-            exceptionCaught( session, t );
+            fireExceptionCaught( session, t );
         }
 
         // And start the chain.
@@ -463,11 +463,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void sessionIdle( IoSession session, IdleStatus status )
+    public void fireSessionIdle( IoSession session, IdleStatus status )
     {
         Entry head = this.head;
         callNextSessionIdle(head, session, status);
@@ -483,11 +483,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void messageReceived( IoSession session, Object message )
+    public void fireMessageReceived( IoSession session, Object message )
     {
         Entry head = this.head;
         callNextMessageReceived(head, session, message );
@@ -503,23 +503,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void messageNotSent( IoSession session, WriteRequest request )
-    {
-        try
-        {
-            request.getFuture().setWritten( false );
-        }
-        catch( Throwable t )
-        {
-            exceptionCaught( session, t );
-        }
-    }
-
-    public void messageSent( IoSession session, WriteRequest request )
+    public void fireMessageSent( IoSession session, WriteRequest request )
     {
         try
         {
@@ -527,7 +515,7 @@
         }
         catch( Throwable t )
         {
-            exceptionCaught( session, t );
+            fireExceptionCaught( session, t );
         }
         
         Entry head = this.head;
@@ -544,11 +532,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void exceptionCaught( IoSession session, Throwable cause )
+    public void fireExceptionCaught( IoSession session, Throwable cause )
     {
         Entry head = this.head;
         callNextExceptionCaught(head, session, cause);
@@ -570,7 +558,7 @@
         }
     }
 
-    public void filterWrite( IoSession session, WriteRequest writeRequest )
+    public void fireFilterWrite( IoSession session, WriteRequest writeRequest )
     {
         Entry tail = this.tail;
         callPreviousFilterWrite( tail, session, writeRequest );
@@ -586,11 +574,11 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 
-    public void filterClose( IoSession session )
+    public void fireFilterClose( IoSession session )
     {
         Entry tail = this.tail;
         callPreviousFilterClose( tail, session );
@@ -605,7 +593,7 @@
         }
         catch( Throwable e )
         {
-            exceptionCaught( session, e );
+            fireExceptionCaught( session, e );
         }
     }
 

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
Sun Sep 10 22:11:58 2006
@@ -350,7 +350,7 @@
                     getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
                     req.config.getFilterChainBuilder().buildFilterChain( session.getFilterChain()
);
                     req.config.getThreadModel().buildFilterChain( session.getFilterChain()
);
-                    ( ( SocketFilterChain ) session.getFilterChain() ).sessionCreated( session
);
+                    session.getFilterChain().fireSessionCreated( session );
                     session.getIoProcessor().addNew( session );
                     success = true;
                 }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
Sun Sep 10 22:11:58 2006
@@ -358,7 +358,7 @@
             getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
             config.getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
             config.getThreadModel().buildFilterChain( session.getFilterChain() );
-            ( ( SocketFilterChain ) session.getFilterChain() ).sessionCreated( session );
+            session.getFilterChain().fireSessionCreated( session );
         }
         catch( Throwable e )
         {

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketIoProcessor.java
Sun Sep 10 22:11:58 2006
@@ -169,13 +169,13 @@
             catch( IOException e )
             {
                 registered = false;
-                ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                session.getFilterChain().fireExceptionCaught( session, e );
             }
 
             if( registered )
             {
                 session.getServiceListeners().fireSessionCreated( session );
-                ( ( SocketFilterChain ) session.getFilterChain() ).sessionOpened( session
);
+                session.getFilterChain().fireSessionOpened( session );
             }
         }
     }
@@ -219,14 +219,14 @@
             }
             catch( IOException e )
             {
-                ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                session.getFilterChain().fireExceptionCaught( session, e );
             }
             finally
             {
                 releaseWriteBuffers( session );
                 session.getServiceListeners().fireSessionDestroyed( session );
 
-                ( ( SocketFilterChain ) session.getFilterChain() ).sessionClosed( session
);
+                session.getFilterChain().fireSessionClosed( session );
             }
         }
     }
@@ -282,7 +282,7 @@
 
             if( readBytes > 0 )
             {
-                ( ( SocketFilterChain ) session.getFilterChain() ).messageReceived( session,
buf );
+                session.getFilterChain().fireMessageReceived( session, buf );
                 buf = null;
             }
             if( ret < 0 )
@@ -294,7 +294,7 @@
         {
             if( e instanceof IOException )
                 scheduleRemove( session );
-            ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+            session.getFilterChain().fireExceptionCaught( session, e );
         }
         finally
         {
@@ -353,7 +353,7 @@
             && ( currentTime - lastIoTime ) >= idleTime )
         {
             session.increaseIdleCount( status );
-            ( ( SocketFilterChain ) session.getFilterChain() ).sessionIdle( session, status
);
+            session.getFilterChain().fireSessionIdle( session, status );
         }
     }
 
@@ -367,7 +367,7 @@
             && key != null && key.isValid()
             && ( key.interestOps() & SelectionKey.OP_WRITE ) != 0 )
         {
-            ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
new WriteTimeoutException() );
+            session.getFilterChain().fireExceptionCaught( session, new WriteTimeoutException()
);
         }
     }
 
@@ -415,7 +415,7 @@
             catch( IOException e )
             {
                 scheduleRemove( session );
-                ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                session.getFilterChain().fireExceptionCaught( session, e );
             }
         }
     }
@@ -433,11 +433,11 @@
             }
             catch( IllegalStateException e )
             {
-                ( ( SocketFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                session.getFilterChain().fireExceptionCaught( session, e );
             }
             finally
             {
-                ( ( SocketFilterChain ) session.getFilterChain() ).messageNotSent( session,
req );
+                req.getFuture().setWritten( false );
             }
         }
     }
@@ -474,7 +474,7 @@
                 session.increaseWrittenWriteRequests();
 
                 buf.reset();
-                ( ( SocketFilterChain ) session.getFilterChain() ).messageSent( session,
req );
+                session.getFilterChain().fireMessageSent( session, req );
                 continue;
             }
 

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketSessionImpl.java
Sun Sep 10 22:11:58 2006
@@ -157,7 +157,7 @@
 
     protected void close0()
     {
-        filterChain.filterClose( this );
+        filterChain.fireFilterClose( this );
     }
 
     Queue getWriteRequestQueue()
@@ -183,7 +183,7 @@
 
     protected void write0( WriteRequest writeRequest )
     {
-        filterChain.filterWrite( this, writeRequest );
+        filterChain.fireFilterWrite( this, writeRequest );
     }
 
     public TransportType getTransportType()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
Sun Sep 10 22:11:58 2006
@@ -236,7 +236,7 @@
         try
         {
             buildFilterChain( req, s );
-            ( ( DatagramFilterChain ) s.getFilterChain() ).sessionCreated( s );
+            s.getFilterChain().fireSessionCreated( s );
         }
         catch( Throwable t )
         {
@@ -378,7 +378,7 @@
             try
             {
                 buildFilterChain( req, session );
-                ( ( DatagramFilterChain ) session.getFilterChain() ).sessionCreated( session
);
+                ( ( DatagramFilterChain ) session.getFilterChain() ).fireSessionCreated(
session );
 
                 if( key.isReadable() )
                 {
@@ -415,12 +415,12 @@
                 newBuf.flip();
 
                 session.increaseReadBytes( newBuf.remaining() );
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageReceived( session,
newBuf );
+                session.getFilterChain().fireMessageReceived( session, newBuf );
             }
         }
         catch( IOException e )
         {
-            ( ( DatagramFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+            ( ( DatagramFilterChain ) session.getFilterChain() ).fireExceptionCaught( session,
e );
         }
         finally
         {
@@ -451,7 +451,7 @@
             }
             catch( IOException e )
             {
-                ( ( DatagramFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                ( ( DatagramFilterChain ) session.getFilterChain() ).fireExceptionCaught(
session, e );
             }
         }
     }
@@ -484,7 +484,7 @@
 
                 session.increaseWrittenWriteRequests();
                 buf.reset();
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageSent( session,
req );
+                ( ( DatagramFilterChain ) session.getFilterChain() ).fireMessageSent( session,
req );
                 continue;
             }
 
@@ -526,7 +526,7 @@
                 session.increaseWrittenBytes( writtenBytes );
                 session.increaseWrittenWriteRequests();
                 buf.reset();
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageSent( session,
req );
+                ( ( DatagramFilterChain ) session.getFilterChain() ).fireMessageSent( session,
req );
             }
         }
     }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
Sun Sep 10 22:11:58 2006
@@ -417,12 +417,12 @@
                 newBuf.flip();
 
                 session.increaseReadBytes( readBytes );
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageReceived( session,
newBuf );
+                session.getFilterChain().fireMessageReceived( session, newBuf );
             }
         }
         catch( IOException e )
         {
-            ( ( DatagramFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+            session.getFilterChain().fireExceptionCaught( session, e );
         }
         finally
         {
@@ -453,7 +453,7 @@
             }
             catch( IOException e )
             {
-                ( ( DatagramFilterChain ) session.getFilterChain() ).exceptionCaught( session,
e );
+                session.getFilterChain().fireExceptionCaught( session, e );
             }
         }
     }
@@ -486,7 +486,7 @@
 
                 session.increaseWrittenWriteRequests();
                 buf.reset();
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageSent( session,
req );
+                session.getFilterChain().fireMessageSent( session, req );
                 continue;
             }
 
@@ -522,7 +522,7 @@
                 session.increaseWrittenBytes( writtenBytes );
                 session.increaseWrittenWriteRequests();
                 buf.reset();
-                ( ( DatagramFilterChain ) session.getFilterChain() ).messageSent( session,
req );
+                session.getFilterChain().fireMessageSent( session, req );
             }
         }
     }
@@ -553,7 +553,7 @@
             try
             {
                 buildFilterChain( req, session );
-                ( ( DatagramFilterChain ) session.getFilterChain() ).sessionCreated( session
);
+                session.getFilterChain().fireSessionCreated( session );
 
                 SelectionKey key = req.channel.register( selector,
                         SelectionKey.OP_READ, session );

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Sun Sep 10 22:11:58 2006
@@ -147,7 +147,7 @@
     
     protected void close0()
     {
-        filterChain.filterClose( this );
+        filterChain.fireFilterClose( this );
     }
 
     Queue getWriteRequestQueue()
@@ -167,7 +167,7 @@
 
     protected void write0( WriteRequest writeRequest )
     {
-        filterChain.filterWrite( this, writeRequest );
+        filterChain.fireFilterWrite( this, writeRequest );
     }
 
     public int getScheduledWriteRequests()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeFilterChain.java
Sun Sep 10 22:11:58 2006
@@ -35,7 +35,7 @@
         super( session );
     }
 
-    public void messageReceived( IoSession session, Object message )
+    public void fireMessageReceived( IoSession session, Object message )
     {
         VmPipeSessionImpl s = ( VmPipeSessionImpl ) session;
         synchronized( s.lock )
@@ -57,7 +57,7 @@
                 
                 s.increaseReadBytes( byteCount );
                 
-                super.messageReceived( s, message );
+                super.fireMessageReceived( s, message );
             }
         }
     }
@@ -99,14 +99,14 @@
                     s.increaseWrittenBytes( byteCount );
                     s.increaseWrittenWriteRequests();
     
-                    ( ( VmPipeFilterChain ) s.getFilterChain() ).messageSent( s, writeRequest
);
-                    ( ( VmPipeFilterChain ) s.remoteSession.getFilterChain() )
-                                .messageReceived( s.remoteSession, messageCopy );
+                    s.getFilterChain().fireMessageSent( s, writeRequest );
+                    s.remoteSession.getFilterChain()
+                                .fireMessageReceived( s.remoteSession, messageCopy );
                 }
             }
             else 
             {
-                ( ( VmPipeFilterChain ) s.getFilterChain() ).messageNotSent( s, writeRequest
);
+                writeRequest.getFuture().setWritten( false );
             }
         }
     }
@@ -119,7 +119,7 @@
             if( !session.getCloseFuture().isClosed() )
             {
                 s.getManagedSessions().remove( s );
-                ( ( VmPipeFilterChain ) s.getFilterChain() ).sessionClosed( session );
+                s.getFilterChain().fireSessionClosed( session );
                 s.remoteSession.close();
             }
         }

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeIdleStatusChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeIdleStatusChecker.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeIdleStatusChecker.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeIdleStatusChecker.java
Sun Sep 10 22:11:58 2006
@@ -24,7 +24,6 @@
 import java.util.Map;
 
 import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.support.AbstractIoFilterChain;
 
 /**
  * Dectects idle sessions and fires <tt>sessionIdle</tt> events to them. 
@@ -127,7 +126,7 @@
             && ( currentTime - lastIoTime ) >= idleTime )
         {
             session.increaseIdleCount( status );
-            ( ( AbstractIoFilterChain ) session.getFilterChain() ).sessionIdle( session,
status );
+            session.getFilterChain().fireSessionIdle( session, status );
         }
     }
 

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
Sun Sep 10 22:11:58 2006
@@ -83,7 +83,7 @@
             remoteEntry.getAcceptor().getFilterChainBuilder().buildFilterChain( remoteSession.getFilterChain()
);
             remoteEntry.getConfig().getFilterChainBuilder().buildFilterChain( remoteSession.getFilterChain()
);
             remoteEntry.getConfig().getThreadModel().buildFilterChain( remoteSession.getFilterChain()
);
-            ( ( VmPipeFilterChain ) remoteSession.getFilterChain() ).sessionCreated( remoteSession
);
+            remoteSession.getFilterChain().fireSessionCreated( remoteSession );
         }
         catch( Throwable t )
         {
@@ -112,8 +112,8 @@
         remoteSession.managedSessions.add( remoteSession );
         this.managedSessions.add( this );
         
-        ( ( VmPipeFilterChain ) remoteSession.getFilterChain() ).sessionOpened( remoteSession
);
-        filterChain.sessionOpened( this );
+        remoteSession.getFilterChain().fireSessionOpened( remoteSession );
+        filterChain.fireSessionOpened( this );
     }
 
     /**
@@ -165,12 +165,12 @@
 
     protected void close0()
     {
-        filterChain.filterClose( this );
+        filterChain.fireFilterClose( this );
     }
     
     protected void write0( WriteRequest writeRequest )
     {
-        this.filterChain.filterWrite( this, writeRequest );
+        this.filterChain.fireFilterWrite( this, writeRequest );
     }
 
     public int getScheduledWriteRequests()
@@ -223,7 +223,7 @@
                 }
                 else
                 {
-                    filterChain.messageReceived( this, data[ i ] );
+                    filterChain.fireMessageReceived( this, data[ i ] );
                 }
             }
         }

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java?view=diff&rev=442102&r1=442101&r2=442102
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/common/IoFilterChainTest.java
Sun Sep 10 22:11:58 2006
@@ -179,13 +179,13 @@
     
     private void run( String expectedResult )
     {
-        chain.sessionCreated( session );
-        chain.sessionOpened( session );
-        chain.messageReceived( session, new Object() );
-        chain.filterWrite( session, new WriteRequest( new Object() ) );
-        chain.sessionIdle( session, IdleStatus.READER_IDLE );
-        chain.exceptionCaught( session, new Exception() );
-        chain.sessionClosed( session );
+        chain.fireSessionCreated( session );
+        chain.fireSessionOpened( session );
+        chain.fireMessageReceived( session, new Object() );
+        chain.fireFilterWrite( session, new WriteRequest( new Object() ) );
+        chain.fireSessionIdle( session, IdleStatus.READER_IDLE );
+        chain.fireExceptionCaught( session, new Exception() );
+        chain.fireSessionClosed( session );
         
         result = formatResult( result );
         expectedResult = formatResult( expectedResult );
@@ -459,7 +459,7 @@
 
         protected void doWrite( IoSession session, WriteRequest writeRequest )
         {
-            messageSent( session, writeRequest );
+            fireMessageSent( session, writeRequest );
         }
 
         protected void doClose( IoSession session )



Mime
View raw message