Methods Summary |
---|
private void | add(java.lang.Runnable target, java.lang.Object lock)
try {
cvFlag.getBusyFlag();
if (terminated)
throw new IllegalStateException("Thread pool has shutdown");
objects.addElement(new ThreadPoolRequest(target, lock));
nObjects++;
cvAvailable.cvSignal();
} finally {
cvFlag.freeBusyFlag();
}
|
public void | addRequest(java.lang.Runnable target)
add(target, null);
|
public void | addRequestAndWait(java.lang.Runnable target)
Object lock = new Object();
synchronized(lock) {
add(target, lock);
lock.wait();
}
|
public void | waitForAll(boolean terminate)
try {
cvFlag.getBusyFlag();
while (nObjects != 0)
cvEmpty.cvWait();
if (terminate) {
for (int i = 0; i < poolThreads.length; i++)
poolThreads[i].shouldRun = false;
cvAvailable.cvBroadcast();
terminated = true;
}
} finally {
cvFlag.freeBusyFlag();
}
|
public void | waitForAll()
waitForAll(false);
|