public long getTaskCompletionTimeout() { return wrapper.getTaskCompletionTimeout(); } /** Get the time remaining to the complete timeout timestamp in MS.
/** * Execute a task on the same thread * * @param wrapper the task wrapper */ protected void executeOnThread(TaskWrapper wrapper) { if( trace ) log.trace("executeOnThread, wrapper="+wrapper); wrapper.run(); }
/** Invoke stopTask on the wrapper and indicate whether this was the first * time the task has been notified to stop. * @return true if this is the first stopTask, false on the second. */ public boolean stopTask() { wrapper.stopTask(); boolean wasFirstStop = firstStop == false; firstStop = true; return wasFirstStop; } }
if (stopped.get()) wrapper.rejectTask(new ThreadPoolStoppedException("Thread pool has been stopped")); return; wrapper.acceptTask(); long completionTimeout = wrapper.getTaskCompletionTimeout(); TimeoutInfo info; if(completionTimeout > 0) tasksWithTimeouts.add(info); int waitType = wrapper.getTaskWaitType(); switch (waitType)
/** * Wait for a task * * @param wrapper the task wrapper */ protected void waitForTask(TaskWrapper wrapper) { wrapper.waitForTask(); }
/** * Execute a task * * @param wrapper the task wrapper */ protected void execute(TaskWrapper wrapper) { if( trace ) log.trace("execute, wrapper="+wrapper); try { executor.execute(wrapper); } catch (Throwable t) { wrapper.rejectTask(new ThreadPoolFullException("Error scheduling work: " + wrapper, t)); } }
if( wrapper.isComplete() == false )