protected GlowWorker(final GlowTask task, final GlowScheduler scheduler) { this.id = task.getTaskId(); this.owner = task.getOwner(); this.task = task; this.thread = new Thread( new Runnable() { public void run() { task.pulse(); scheduler.workerComplete(GlowWorker.this); } }); thread.start(); }
public void cancel() { if (thread == null) return; if (!thread.isAlive()) { thread.interrupt(); return; } task.cancel(); }
public void run() { shouldContinue = task.pulse(); }