directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r209570 - /directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java
Date Thu, 07 Jul 2005 07:09:10 GMT
Author: trustin
Date: Thu Jul  7 00:09:09 2005
New Revision: 209570

URL: http://svn.apache.org/viewcvs?rev=209570&view=rev
Log:
Fix for DIRMINA-72
* busySessionBuffers has not been maintained correctly.

Modified:
    directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java

Modified: directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java?rev=209570&r1=209569&r2=209570&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/filter/ThreadPoolFilter.java Thu Jul
 7 00:09:09 2005
@@ -165,7 +165,8 @@
                 if( buf == null )
                 {
                     buf = new SessionBuffer( session );
-                    buffers.put( session, buf );
+                    Object old = buffers.put( session, buf );
+                    //System.out.println( "new " + System.identityHashCode( session ) + "
(" + ( old == null ) + ')' );
                 }
             }
         }
@@ -178,7 +179,8 @@
         final IoSession session = buf.session;
         synchronized( buffers )
         {
-            buffers.remove( session );
+            Object old = buffers.remove( session );
+            //System.out.println( Thread.currentThread().getName() + " del " + System.identityHashCode(
session ) + " (" + ( old != null ) + ')' );
         }
     }
 
@@ -216,12 +218,15 @@
 
         public void run()
         {
+            String name = Thread.currentThread().getName();
             for( ;; )
             {
                 if( !waitForPromotion() )
                     break;
-
+                
+                //System.out.println( name + " promoted" );
                 SessionBuffer buf = fetchBuffer();
+                //System.out.println( name + " fetched: " + (buf != null? System.identityHashCode(buf)
: 0 ) );
                 giveUpLead();
 
                 if( buf == null )
@@ -319,9 +324,10 @@
 
             synchronized( readySessionBuffers )
             {
-                busySessionBuffers.remove( buf );
                 if( eventQueue.isEmpty() )
                 {
+                    boolean removed = busySessionBuffers.remove( buf );
+                    //System.out.println( Thread.currentThread().getName() + " busyDel: "
+ System.identityHashCode( buf.session ) + " (" + removed + ')' );
                     removeSessionBuffer( buf );
                 }
                 else
@@ -405,24 +411,32 @@
 
     private static class EventType
     {
-        public static final EventType OPENED = new EventType();
+        public static final EventType OPENED = new EventType( "OPENED" );
 
-        public static final EventType CLOSED = new EventType();
+        public static final EventType CLOSED = new EventType( "CLOSED" );
 
-        public static final EventType READ = new EventType();
+        public static final EventType READ = new EventType( "READ" );
 
-        public static final EventType WRITTEN = new EventType();
+        public static final EventType WRITTEN = new EventType( "WRITTEN" );
 
-        public static final EventType RECEIVED = new EventType();
+        public static final EventType RECEIVED = new EventType( "RECEIVED" );
 
-        public static final EventType SENT = new EventType();
+        public static final EventType SENT = new EventType( "SENT" );
 
-        public static final EventType IDLE = new EventType();
+        public static final EventType IDLE = new EventType( "IDLE" );
 
-        public static final EventType EXCEPTION = new EventType();
+        public static final EventType EXCEPTION = new EventType( "EXCEPTION" );
 
-        private EventType()
+        private final String value;
+        
+        private EventType( String value )
+        {
+            this.value = value;
+        }
+        
+        public String toString()
         {
+            return value;
         }
     }
     



Mime
View raw message