/** * Execute a task. Triggers the task to * be executed in future. * @param executable The task to execute. * @param listener Called when execution has started. */ public synchronized void execute(IExecutable executable, double priority) { tasks.add(new Task(executable, priority)); // Concurrency==0 means not currently running -> start. if(concurrency==0) { try { executor.execute(); } catch(Exception e) { // ignore, can only be caused by terminated threadpool service. } } }