public boolean isAlive() {
return !thread.isAlive();
}
public void run() {
TimedTask task = null;
while (active) {
try {
long tm;
while (active) {
timeSampleStart = nanoTime();
if ((task = pool.getNextTask()) == null) {
continue;
}
tm = nanoTime();
task.run();
cpuTime = (nanoTime() - tm);
calculateLoad();
}
}
catch (InterruptedException e) {
if (!active) {
/**
* If the thread has been marked inactive, terminate now. Otherwise continue along
* normally.
*/
return;
}
}
catch (Throwable t) {
if (task != null) {
task.cancel(true);
}
if (errorCallback != null) {
/**
* If the errorCallback is defined for this ThreadWorker, we report the exception we