[jboss-cvs] JBossAS SVN: r86371 - projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 25 14:53:35 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-03-25 14:53:35 -0400 (Wed, 25 Mar 2009)
New Revision: 86371

Modified:
   projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java
Log:
Prevent possible problem where a thread pool is shut down from within itself

Modified: projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java
===================================================================
--- projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java	2009-03-25 16:46:46 UTC (rev 86370)
+++ projects/jboss-threads/trunk/main/src/main/java/org/jboss/threads/SimpleQueueExecutor.java	2009-03-25 18:53:35 UTC (rev 86371)
@@ -216,6 +216,9 @@
         final Lock lock = this.lock;
         lock.lockInterruptibly();
         try {
+            if (workers.contains(Thread.currentThread())) {
+                throw new IllegalStateException("Cannot await termination of a thread pool from one of its threads");
+            }
             final long start = System.currentTimeMillis();
             long elapsed = 0L;
             while (! stop && threadCount > 0) {




More information about the jboss-cvs-commits mailing list