protected void checkNext ( ) { _executingNow = ! _queue . isEmpty ( ) ; if ( _executingNow ) { // start up a thread to execute the task in question ExecutorTask task = _queue . remove ( 0 ) ; final ExecutorThread thread = new ExecutorThread ( task ) ; thread . start ( ) ; // start up a timer that will abort this thread after the specified timeout new Interval ( Interval . RUN_DIRECT ) { @ Override public void expired ( ) { // this will NOOP if the task has already completed thread . abort ( ) ; } } . schedule ( task . getTimeout ( ) ) ; } }
Execute the next task if applicable .