directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r442807 - in /directory/trunks/mina/core/src: main/java/org/apache/mina/transport/socket/nio/SocketConnector.java test/java/org/apache/mina/transport/AbstractTrafficControlTest.java
Date Wed, 13 Sep 2006 03:03:03 GMT
Author: trustin
Date: Tue Sep 12 20:03:03 2006
New Revision: 442807

URL: http://svn.apache.org/viewvc?view=rev&rev=442807
Log:
Removed the workaround for AbstractTrafficControlTest

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    directory/trunks/mina/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java

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=442807&r1=442806&r2=442807
==============================================================================
--- 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
Tue Sep 12 20:03:03 2006
@@ -33,10 +33,8 @@
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoConnectorConfig;
-import org.apache.mina.common.IoFilterAdapter;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
-import org.apache.mina.common.IoSession;
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.common.support.DefaultConnectFuture;
 import org.apache.mina.util.Queue;
@@ -343,7 +341,7 @@
         }
     }
 
-    private void newSession( SocketChannel ch, IoHandler handler, IoServiceConfig config,
final ConnectFuture connectFuture )
+    private void newSession( SocketChannel ch, IoHandler handler, IoServiceConfig config,
ConnectFuture connectFuture )
         throws IOException
     {
         SocketSessionImpl session = new SocketSessionImpl( this,
@@ -358,28 +356,13 @@
             getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
             config.getFilterChainBuilder().buildFilterChain( session.getFilterChain() );
             config.getThreadModel().buildFilterChain( session.getFilterChain() );
-            session.getFilterChain().addFirst("__CONNECT_FUTURE_NOTIFIER__", new IoFilterAdapter()
-            {
-
-                public void sessionCreated( NextFilter nextFilter, IoSession session ) throws
Exception
-                {
-                    session.getFilterChain().remove( "__CONNECT_FUTURE_NOTIFIER__" );
-                    try
-                    {
-                        nextFilter.sessionCreated( session );
-                    }
-                    finally
-                    {
-                        connectFuture.setSession( session );
-                    }
-                }
-            });
         }
         catch( Throwable e )
         {
             throw ( IOException ) new IOException( "Failed to create a session." ).initCause(
e );
         }
         session.getIoProcessor().addNew( session );
+        connectFuture.setSession( session );
     }
 
     private SocketIoProcessor nextProcessor()

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java?view=diff&rev=442807&r1=442806&r2=442807
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/transport/AbstractTrafficControlTest.java
Tue Sep 12 20:03:03 2006
@@ -77,6 +77,13 @@
         future.join();
         IoSession session = future.getSession();
         
+        // We wait for the sessionCreated() event is fired becayse we cannot guarentee that
+        // it is invoked already.
+        while( session.getAttribute( "lock" ) == null )
+        {
+            Thread.yield();
+        }
+        
         Object lock = session.getAttribute( "lock" );
         synchronized( lock )
         {



Mime
View raw message