teiid SVN: r679 - trunk/common-internal/src/main/java/com/metamatrix/common/queue.
by teiid-commits@lists.jboss.org
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();
15 years, 8 months