portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r932928 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl: WorkerImpl.java WorkerMonitorImpl.java
Date Sun, 11 Apr 2010 16:02:25 GMT
Author: taylor
Date: Sun Apr 11 16:02:25 2010
New Revision: 932928

URL: http://svn.apache.org/viewvc?rev=932928&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-1183
worker threads seem to be shutting down in Tomcat 6.0.26
tests pass

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerImpl.java?rev=932928&r1=932927&r2=932928&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerImpl.java
Sun Apr 11 16:02:25 2010
@@ -44,11 +44,11 @@ public class WorkerImpl extends Thread i
     protected final static Logger log = LoggerFactory.getLogger(WorkerImpl.class);
 
     /** Running status of this worker */
-    private boolean running = true;
+    private volatile boolean running = true;
 
     /** Counter of consecutive jobs that can be processed before the
         worker being actually put back on the idle queue */
-    private int jobCount = 0;
+    private volatile int jobCount = 0;
 
     /** Job to process */
     Runnable job = null;
@@ -152,7 +152,8 @@ public class WorkerImpl extends Thread i
                     }
                     catch (InterruptedException e)
                     {
-                        // nothing done
+                        ((WorkerMonitorImpl) monitor).release(this);
+                        this.running = false;
                     }
                 }
             }
@@ -203,5 +204,11 @@ public class WorkerImpl extends Thread i
             ((WorkerMonitorImpl) monitor).release(this);
         }
     }
+
+    public void interrupt()
+    {
+    	this.running = false;
+    	super.interrupt();
+    }
     
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java?rev=932928&r1=932927&r2=932928&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
Sun Apr 11 16:02:25 2010
@@ -20,6 +20,7 @@ package org.apache.jetspeed.aggregator.i
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Stack;
 import java.util.LinkedList;
@@ -106,6 +107,14 @@ public class WorkerMonitorImpl implement
 
     public void stop()
     {    
+    	for (WorkerImpl worker : workers)
+    	{
+    		worker.interrupt();
+    	}
+    	for (WorkerImpl worker : workersMonitored)
+    	{
+    		worker.interrupt();
+    	}
     	if (jobMonitor != null)
     	{
     		jobMonitor.endThread();



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message