task = executor.submit(() -> {
try
{
- Cache.log.debug(format("Worker %s started",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Worker %s started", getWorker()));
getWorker().run();
- Cache.log.debug(format("Worker %s finished",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Worker %s finished", getWorker()));
} catch (InterruptedException e)
{
- Cache.log.debug(format("Worker %s interrupted",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Worker %s interrupted", getWorker()));
} catch (Throwable th)
{
- Cache.log.debug(format("Worker %s failed",
- getWorker().getClass().getName()), th);
+ Cache.log.debug(format("Worker %s failed", getWorker()), th);
} finally
{
if (!isRegistered())
{
return;
}
- Cache.log.debug(format("Cancelling worker %s",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Cancelling worker %s", getWorker()));
task.cancel(true);
}
}
"Cannot submit new task if the prevoius one is still running");
}
Cache.log.debug(
- format("Worker %s queued", getWorker().getClass().getName()));
+ format("Worker %s queued", getWorker()));
final var runnable = new Runnable()
{
private boolean started = false;
{
if (!started)
{
- Cache.log.debug(format("Worker %s started",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Worker %s started", getWorker()));
getWorker().startUp();
started = true;
}
else if (!completed)
{
- Cache.log.debug(format("Polling worker %s",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Polling worker %s", getWorker()));
if (getWorker().poll())
{
- Cache.log.debug(format("Worker %s finished",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Worker %s finished", getWorker()));
completed = true;
}
}
} catch (Throwable th)
{
- Cache.log.debug(format("Worker %s failed",
- getWorker().getClass().getName()), th);
+ Cache.log.debug(format("Worker %s failed", getWorker()), th);
completed = true;
}
if (completed)
final var worker = getWorker();
if (!isRegistered())
PollableWorkerManager.super.worker = null;
- Cache.log.debug(format("Finalizing completed worker %s",
- worker.getClass().getName()));
+ Cache.log.debug(format("Finalizing completed worker %s", worker));
worker.done();
// almost impossible, but the future may be null at this point
// let it throw NPE to cancel forcefully
{
return;
}
- Cache.log.debug(format("Cancelling worker %s",
- getWorker().getClass().getName()));
+ Cache.log.debug(format("Cancelling worker %s", getWorker()));
task.cancel(false);
executor.submit(() -> {
final var worker = getWorker();
if (worker != null)
{
worker.cancel();
- Cache.log.debug(format("Finalizing cancelled worker %s",
- worker.getClass().getName()));
+ Cache.log.debug(format("Finalizing cancelled worker %s", worker));
worker.done();
}
});