Methods Summary |
---|
public synchronized void | close()
if (isAlive) {
isAlive = false;
taskQueue.clear();
interrupt();
}
|
protected synchronized java.lang.Runnable | getTask()
while (taskQueue.size() == 0) {
if (!isAlive) {
return null;
}
wait();
}
Logger.global.info("1 Task is removed");
return (Runnable) taskQueue.removeFirst();
|
public void | join()
synchronized (this) {
isAlive = false;
notifyAll();
}
Thread[] threads = new Thread[activeCount()];
int count = enumerate(threads);
for (int i = 0; i < count; i++) {
try {
threads[i].join();
} catch (InterruptedException ex) {
System.err.println(ex.getMessage());
}
}
|
public synchronized void | runTask(java.lang.Runnable task)
if (!isAlive) {
throw new IllegalStateException();
}
if (task != null) {
taskQueue.add(task);
notify();
}
|