- Timestamp:
- 10/14/13 16:38:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/supervisor/src/main/java/omq/server/RemoteThreadPool.java
r101 r102 4 4 import java.util.ArrayList; 5 5 import java.util.List; 6 import java.util.ListIterator; 6 7 import java.util.concurrent.atomic.AtomicInteger; 7 8 … … 102 103 long now = System.currentTimeMillis(); 103 104 104 int i = 0; 105 for (InvocationThread worker : workers) { 106 // Ensure there are at least minThreads available 107 if (workers.size() == minPoolThreads) { 108 break; 109 } 105 ListIterator<InvocationThread> lIter = workers.listIterator(); 106 while (workers.size() > minPoolThreads && lIter.hasNext()) { 107 InvocationThread worker = lIter.next(); 110 108 long lastExec = worker.getLastExecution(); 111 109 System.out.println("last - now = " + (now - lastExec) + " keep alive = " + keepAliveTime); … … 114 112 try { 115 113 worker.kill(); 116 workers.remove(i);114 lIter.remove(); 117 115 } catch (IOException e) { 118 // TODO Auto-generated catch block 119 e.printStackTrace(); 116 logger.error(e); 120 117 } 121 118 122 119 } 123 i++;124 120 } 125 121 }
Note: See TracChangeset
for help on using the changeset viewer.