[teiid-commits] teiid SVN: r679 - trunk/common-internal/src/main/java/com/metamatrix/common/queue.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Mar 31 21:09:19 EDT 2009


Author: shawkins
Date: 2009-03-31 21:09:19 -0400 (Tue, 31 Mar 2009)
New Revision: 679

Modified:
   trunk/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java
Log:
TEIID-445 refinement of cancellation

Modified: trunk/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java	2009-03-31 22:46:16 UTC (rev 678)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/queue/WorkerPoolFactory.java	2009-04-01 01:09:19 UTC (rev 679)
@@ -216,14 +216,13 @@
 									completedCount++;
 									r = queue.poll();		
 								}
-								if (r != null) {
-									continue;
+								if (!success || r == null) {
+									threads.remove(t);
+									activeCount--;
+									if (activeCount == 0 && terminated) {
+										poolLock.notifyAll();
+									}		
 								}
-								threads.remove(t);
-								activeCount--;
-								if (activeCount == 0 && terminated) {
-									poolLock.notifyAll();
-								}		
 							}
 							t.setName(name);
 						}
@@ -261,7 +260,7 @@
 		public void shutdown() {
 			this.terminated = true;
 			synchronized (scheduledTasks) {
-				for (ScheduledFuture<?> future : scheduledTasks) {
+				for (ScheduledFuture<?> future : new ArrayList<ScheduledFuture<?>>(scheduledTasks)) {
 					future.cancel(false);
 				}
 				scheduledTasks.clear();




More information about the teiid-commits mailing list