directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r385263 - in /directory/trunks/mina: core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java examples/src/main/java/org/apache/mina/examples/sumup/Client.java
Date Sun, 12 Mar 2006 09:31:33 GMT
Author: trustin
Date: Sun Mar 12 01:31:32 2006
New Revision: 385263

URL: http://svn.apache.org/viewcvs?rev=385263&view=rev
Log:
Making required changes since I resolve DIRMINA-190...


Modified:
    directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
    directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/sumup/Client.java

Modified: directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java?rev=385263&r1=385262&r2=385263&view=diff
==============================================================================
--- directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
(original)
+++ directory/trunks/mina/core/src/test/java/org/apache/mina/filter/StreamWriteFilterTest.java
Sun Mar 12 01:31:32 2006
@@ -383,43 +383,35 @@
         SocketAddress address = new InetSocketAddress( "localhost", AvailablePortFinder.getNextAvailable()
);
 
         IoConnector connector = new SocketConnector();
-        ThreadPoolFilter threadPoolFilter = new ThreadPoolFilter();
-        threadPoolFilter.start();
         
-        try {
-            connector.getDefaultConfig().getFilterChain().addFirst( "threadPool", threadPoolFilter
);
-            
-            FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
-            
-            SenderHandler sender = new SenderHandler( stream );
-            ReceiverHandler receiver = new ReceiverHandler( stream.size );
-            
-            acceptor.bind( address, sender );
-            
-            synchronized( sender.lock )
-            {
-                synchronized( receiver.lock )
-                {
-                    connector.connect( address, receiver );
-                    
-                    sender.lock.wait();
-                    receiver.lock.wait();
-                }
-            }
-            
-            acceptor.unbind( address );
-            
-            assertEquals( stream.bytesRead, receiver.bytesRead );
-            assertEquals( stream.size, receiver.bytesRead );
-            byte[] expectedMd5 = stream.digest.digest();
-            byte[] actualMd5 = receiver.digest.digest();
-            assertEquals( expectedMd5.length, actualMd5.length );
-            for( int i = 0; i < expectedMd5.length; i++ )
+        FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
+        
+        SenderHandler sender = new SenderHandler( stream );
+        ReceiverHandler receiver = new ReceiverHandler( stream.size );
+        
+        acceptor.bind( address, sender );
+        
+        synchronized( sender.lock )
+        {
+            synchronized( receiver.lock )
             {
-                assertEquals( expectedMd5[ i ], actualMd5[ i ] );
+                connector.connect( address, receiver );
+                
+                sender.lock.wait();
+                receiver.lock.wait();
             }
-        } finally {
-            threadPoolFilter.stop();
+        }
+        
+        acceptor.unbind( address );
+        
+        assertEquals( stream.bytesRead, receiver.bytesRead );
+        assertEquals( stream.size, receiver.bytesRead );
+        byte[] expectedMd5 = stream.digest.digest();
+        byte[] actualMd5 = receiver.digest.digest();
+        assertEquals( expectedMd5.length, actualMd5.length );
+        for( int i = 0; i < expectedMd5.length; i++ )
+        {
+            assertEquals( expectedMd5[ i ], actualMd5[ i ] );
         }
     }
 

Modified: directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/sumup/Client.java?rev=385263&r1=385262&r2=385263&view=diff
==============================================================================
--- directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
(original)
+++ directory/trunks/mina/examples/src/main/java/org/apache/mina/examples/sumup/Client.java
Sun Mar 12 01:31:32 2006
@@ -25,7 +25,6 @@
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.ThreadPoolFilter;
 import org.apache.mina.transport.socket.nio.SocketConnector;
 
 /**
@@ -57,18 +56,8 @@
             values[ i ] = Integer.parseInt( args[ i ] );
         }
 
-        // Create I/O and Protocol thread pool filter.
-        // I/O thread pool performs encoding and decoding of messages.
-        // Protocol thread pool performs actual protocol flow.
-        ThreadPoolFilter ioThreadPoolFilter = new ThreadPoolFilter();
-        ThreadPoolFilter protocolThreadPoolFilter = new ThreadPoolFilter();
-        IoConnector connector = new SocketConnector();
-        connector.getDefaultConfig().getFilterChain().addFirst(
-                "ioThreadPool", ioThreadPoolFilter );
-        connector.getDefaultConfig().getFilterChain().addLast(
-                "protocolThreadPool", protocolThreadPoolFilter );
-
         // Set connect timeout.
+        IoConnector connector = new SocketConnector();
         ( ( IoConnectorConfig ) connector.getDefaultConfig() ).setConnectTimeout( CONNECT_TIMEOUT
);
         
         IoSession session;



Mime
View raw message