directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r349659 [2/2] - in /directory/network/branches/chain_refactor: ./ src/examples/org/apache/mina/examples/sumup/ src/examples/org/apache/mina/examples/sumup/codec/ src/examples/org/apache/mina/examples/sumup/message/ src/java/org/apache/mina/...
Date Tue, 29 Nov 2005 07:20:34 GMT
Modified: directory/network/branches/chain_refactor/src/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/chain_refactor/src/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java?rev=349659&r1=349561&r2=349659&view=diff
==============================================================================
--- directory/network/branches/chain_refactor/src/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
(original)
+++ directory/network/branches/chain_refactor/src/java/org/apache/mina/transport/vmpipe/support/VmPipeSessionImpl.java
Mon Nov 28 23:19:46 2005
@@ -8,12 +8,13 @@
 
 import org.apache.mina.common.CloseFuture;
 import org.apache.mina.common.IoFilterChain;
+import org.apache.mina.common.IoFilterChainBuilder;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.common.IoSessionManager;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.common.IoFilter.WriteRequest;
 import org.apache.mina.common.support.BaseIoSession;
-import org.apache.mina.common.support.IoSessionFilterChain;
 import org.apache.mina.filter.codec.ProtocolDecoder;
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.transport.vmpipe.VmPipeSession;
@@ -28,11 +29,11 @@
  */
 public class VmPipeSessionImpl extends BaseIoSession implements VmPipeSession
 {
+    private final IoSessionManager manager;
     private final SocketAddress localAddress;
     private final SocketAddress remoteAddress;
     private final IoHandler handler;
-    private final IoSessionFilterChain filterChain;
-    private final VmPipeSessionManagerFilterChain managerFilterChain;
+    private final VmPipeFilterChain filterChain;
     final VmPipeSessionImpl remoteSession;
     final Object lock;
     final Queue pendingDataQueue;
@@ -40,25 +41,26 @@
     /**
      * Constructor for client-side session.
      */
-    public VmPipeSessionImpl( Object lock, SocketAddress localAddress,
-                   VmPipeSessionManagerFilterChain managerFilterChain,
-                   IoHandler handler,
+    public VmPipeSessionImpl( IoSessionManager manager, Object lock, SocketAddress localAddress,
+                   IoHandler handler, IoFilterChainBuilder filterChainBuilder,
                    VmPipe remoteEntry ) throws IOException
     {
+        this.manager = manager;
         this.lock = lock;
         this.localAddress = localAddress;
         this.remoteAddress = remoteEntry.getAddress();
         this.handler = handler;
-        this.filterChain = new IoSessionFilterChain( this, managerFilterChain );
-        this.managerFilterChain = managerFilterChain;
+        this.filterChain = new VmPipeFilterChain( this );
         this.pendingDataQueue = new Queue();
 
-        remoteSession = new VmPipeSessionImpl( this, remoteEntry );
+        remoteSession = new VmPipeSessionImpl( manager, this, remoteEntry );
         
         // initialize remote session
         try
         {
-            remoteEntry.getManagerFilterChain().sessionCreated( remoteSession );
+            remoteEntry.getAcceptor().getFilterChainBuilder().buildFilterChain( remoteSession.getFilterChain()
);
+            remoteEntry.getFilterChainBuilder().buildFilterChain( remoteSession.getFilterChain()
);
+            ( ( VmPipeFilterChain ) remoteSession.getFilterChain() ).sessionCreated( remoteSession
);
         }
         catch( Throwable t )
         {
@@ -71,6 +73,8 @@
         // initialize client session
         try
         {
+            manager.getFilterChainBuilder().buildFilterChain( remoteSession.getFilterChain()
);
+            filterChainBuilder.buildFilterChain( remoteSession.getFilterChain() );
             handler.sessionCreated( this );
         }
         catch( Throwable t )
@@ -81,30 +85,30 @@
         VmPipeIdleStatusChecker.getInstance().addSession( remoteSession );
         VmPipeIdleStatusChecker.getInstance().addSession( this );
         
-        remoteEntry.getManagerFilterChain().sessionOpened( remoteSession );
-        managerFilterChain.sessionOpened( this );
+        ( ( VmPipeFilterChain ) remoteSession.getFilterChain() ).sessionOpened( remoteSession
);
+        filterChain.sessionOpened( this );
     }
 
     /**
      * Constructor for server-side session.
      */
-    private VmPipeSessionImpl( VmPipeSessionImpl remoteSession, VmPipe entry )
+    private VmPipeSessionImpl( IoSessionManager manager, VmPipeSessionImpl remoteSession,
VmPipe entry )
     {
+        this.manager = manager;
         this.lock = remoteSession.lock;
         this.localAddress = remoteSession.remoteAddress;
         this.remoteAddress = remoteSession.localAddress;
         this.handler = entry.getHandler();
-        this.managerFilterChain = entry.getManagerFilterChain();
-        this.filterChain = new IoSessionFilterChain( this, entry.getManagerFilterChain()
);
+        this.filterChain = new VmPipeFilterChain( this );
         this.remoteSession = remoteSession;
         this.pendingDataQueue = new Queue();
     }
     
-    VmPipeSessionManagerFilterChain getManagerFilterChain()
+    public IoSessionManager getManager()
     {
-        return managerFilterChain;
+        return manager;
     }
-    
+
     public IoFilterChain getFilterChain()
     {
         return filterChain;
@@ -127,7 +131,7 @@
     
     protected void close0( CloseFuture closeFuture )
     {
-        managerFilterChain.filterClose( this, closeFuture );
+        filterChain.filterClose( this, closeFuture );
     }
     
     protected void write0( WriteRequest writeRequest )
@@ -171,11 +175,11 @@
                 if( data[ i ] instanceof WriteRequest )
                 {
                     WriteRequest wr = ( WriteRequest ) data[ i ];
-                    managerFilterChain.doWrite( this, wr );
+                    filterChain.doWrite( this, wr );
                 }
                 else
                 {
-                    managerFilterChain.messageReceived( this, data[ i ] );
+                    filterChain.messageReceived( this, data[ i ] );
                 }
             }
         }



Mime
View raw message