public void run() { while(Thread.currentThread() == runner) { try { Task task=queue.take(); submitToPool(task); } catch(InterruptedException interrupted) { // flag is cleared and we check if the loop should be terminated at the top of the loop } catch(Throwable t) { log.error(Util.getMessage("FailedSubmittingTaskToThreadPool"), t); } } }
protected Future<?> doSchedule(Task task, long initial_delay) { if(task.getRunnable() == null) throw new NullPointerException(); if (isShutdown()) return null; if(initial_delay <= 0) { submitToPool(task); return task; } return add(task); }
public void execute(Runnable task, boolean can_block) { submitToPool(task instanceof TimeScheduler.Task? new RecurringTask(task, TaskType.dynamic, 0, ((TimeScheduler.Task)task).nextInterval(), TimeUnit.MILLISECONDS, can_block) : new Task(task, can_block)); // we'll execute the task directly }
public void run() { while(Thread.currentThread() == runner) { try { Task task=queue.take(); submitToPool(task); } catch(InterruptedException interrupted) { // flag is cleared and we check if the loop should be terminated at the top of the loop } catch(Throwable t) { log.error(Util.getMessage("FailedSubmittingTaskToThreadPool"), t); } } }
protected Future<?> doSchedule(Task task, long initial_delay) { if(task.getRunnable() == null) throw new NullPointerException(); if (isShutdown()) return null; if(initial_delay <= 0) { submitToPool(task); return task; } return add(task); }
public void execute(Runnable task, boolean can_block) { submitToPool(task instanceof TimeScheduler.Task? new RecurringTask(task, TaskType.dynamic, 0, ((TimeScheduler.Task)task).nextInterval(), TimeUnit.MILLISECONDS, can_block) : new Task(task, can_block)); // we'll execute the task directly }