activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r920827 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport: nio/SelectorManager.java nio/SelectorWorker.java stomp/StompNIOTransport.java
Date Tue, 09 Mar 2010 12:18:48 GMT
Author: dejanb
Date: Tue Mar  9 12:18:47 2010
New Revision: 920827

URL: http://svn.apache.org/viewvc?rev=920827&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2440 - fixing bug on marking worker as non empty

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompNIOTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java?rev=920827&r1=920826&r2=920827&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
Tue Mar  9 12:18:47 2010
@@ -99,7 +99,7 @@ public final class SelectorManager {
     }
 
     public synchronized void onWorkerNotFullEvent(SelectorWorker worker) {
-        freeWorkers.add(worker);
+        freeWorkers.addFirst(worker);
     }
 
     public Executor getChannelExecutor() {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java?rev=920827&r1=920826&r2=920827&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/SelectorWorker.java
Tue Mar  9 12:18:47 2010
@@ -53,7 +53,7 @@ public class SelectorWorker implements R
         int use = retainCounter.decrementAndGet();
         if (use == 0) {
             manager.onWorkerEmptyEvent(this);
-        } else if (use < maxChannelsPerWorker) {
+        } else if (use == maxChannelsPerWorker - 1) {
             manager.onWorkerNotFullEvent(this);
         }
     }
@@ -68,18 +68,15 @@ public class SelectorWorker implements R
         selector.wakeup();
     }
     
-    private boolean processIoTasks() {
-        boolean rc = false;
+    private void processIoTasks() {
         Runnable task; 
         while( (task= ioTasks.poll()) !=null ) {
             try {
-                rc = true;
                 task.run();
             } catch (Throwable e) {
                 e.printStackTrace();
             }
         }
-        return rc;
     }
 
     
@@ -90,11 +87,11 @@ public class SelectorWorker implements R
         try {
             Thread.currentThread().setName("Selector Worker: " + id);
             while (!isReleased()) {
-                
-                if( processIoTasks() ) {
-                    continue;
-                }
-                int count = selector.select(10);
+            	
+            	processIoTasks();
+            	
+            	int count = selector.select(10);
+            	
                 if (count == 0) {
                     continue;
                 }
@@ -134,8 +131,8 @@ public class SelectorWorker implements R
                 }
 
             }
-            
-        } catch (Throwable e) {
+        } catch (Throwable e) {         	
+            e.printStackTrace();
             // Notify all the selections that the error occurred.
             Set keys = selector.keys();
             for (Iterator i = keys.iterator(); i.hasNext();) {
@@ -143,12 +140,12 @@ public class SelectorWorker implements R
                 SelectorSelection s = (SelectorSelection)key.attachment();
                 s.onError(e);
             }
-
         } finally {
             try {
                 manager.onWorkerEmptyEvent(this);
                 selector.close();
             } catch (IOException ignore) {
+            	ignore.printStackTrace();
             }
             Thread.currentThread().setName(origName);
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompNIOTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompNIOTransport.java?rev=920827&r1=920826&r2=920827&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompNIOTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompNIOTransport.java
Tue Mar  9 12:18:47 2010
@@ -145,6 +145,7 @@ public class StompNIOTransport extends T
         try {
             selection.close();
         } catch (Exception e) {
+        	e.printStackTrace();
         }
         super.doStop(stopper);
     }



Mime
View raw message