private final Future < Void > executeTask ( final ITask task ) throws TaskExecutionException { if ( task instanceof IOTask ) { final Future < Void > returnVal = executor . submit ( ( IOTask ) task ) ; return returnVal ; } else { try { task . call ( ) ; } catch ( final Exception exc ) { throw new TaskExecutionException ( new ExecutionException ( exc ) ) ; } return null ; } // LOGGER.info("Added a " + task + " to the TaskQueue"); }
This methods appends the given task to the end of the taskQueue and set the calling thread is sleep state .