directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r156149 - incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
Date Fri, 04 Mar 2005 12:41:19 GMT
Author: trustin
Date: Fri Mar  4 04:41:16 2005
New Revision: 156149

URL: http://svn.apache.org/viewcvs?view=rev&rev=156149
Log:
Fixed: ProtocolEncoder and ProtocolDecoder are not instantiated per session.


Modified:
    incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java

Modified: incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java?view=diff&r1=156148&r2=156149
==============================================================================
--- incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
(original)
+++ incubator/directory/network/mina/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
Fri Mar  4 04:41:16 2005
@@ -124,18 +124,12 @@
 
     private class SessionHandlerAdapter implements IoHandler
     {
-        private final ProtocolEncoder encoder;
-
-        private final ProtocolDecoder decoder;
-
+        private final ProtocolCodecFactory codecFactory;
         private final ProtocolHandler handler;
 
         public SessionHandlerAdapter( ProtocolProvider protocolProvider )
         {
-            ProtocolCodecFactory codecFactory = protocolProvider
-                    .getCodecFactory();
-            this.encoder = codecFactory.newEncoder();
-            this.decoder = codecFactory.newDecoder();
+            codecFactory = protocolProvider.getCodecFactory();
             this.handler = protocolProvider.getHandler();
         }
 
@@ -164,6 +158,7 @@
         public void dataRead( IoSession session, ByteBuffer in )
         {
             ProtocolSessionImpl psession = getProtocolSession( session );
+            ProtocolDecoder decoder = psession.decoder;
             try
             {
                 synchronized( decoder )
@@ -219,6 +214,7 @@
         {
             ProtocolSessionImpl psession = ( ProtocolSessionImpl ) session
                     .getAttachment();
+            ProtocolEncoder encoder = psession.encoder;
             Queue writeQueue = psession.writeQueue;
 
             if( writeQueue.isEmpty() )
@@ -285,6 +281,10 @@
         private final SessionHandlerAdapter adapter;
 
         private final Queue writeQueue = new Queue();
+        
+        private final ProtocolEncoder encoder;
+        
+        private final ProtocolDecoder decoder;
 
         private final ProtocolEncoderOutputImpl encOut;
 
@@ -299,6 +299,8 @@
         {
             this.session = session;
             this.adapter = adapter;
+            this.encoder = adapter.codecFactory.newEncoder();
+            this.decoder = adapter.codecFactory.newDecoder();
             this.encOut = new ProtocolEncoderOutputImpl();
             this.decOut = new ProtocolDecoderOutputImpl();
         }
@@ -310,12 +312,12 @@
 
         public ProtocolEncoder getEncoder()
         {
-            return adapter.encoder;
+            return encoder;
         }
 
         public ProtocolDecoder getDecoder()
         {
-            return adapter.decoder;
+            return decoder;
         }
 
         public void close()



Mime
View raw message