public synchronized void shutdownImmediately() {

        if (!this.isShutdown) {
            final Thread runner = this.taskRunnerThread;

            this.isShutdown = true;

            if (runner != null && runner.isAlive()) {
                runner.interrupt();
            }

            this.taskQueue.cancelAllTasks();
        }
    }
public synchronized void shutdownImmediately ( ) { if ( ! this . isShutdown ) { final Thread runner = this . taskRunnerThread ; this . isShutdown = true ; if ( runner != null && runner . isAlive ( ) ) { runner . interrupt ( ) ; } this . taskQueue . cancelAllTasks ( ) ; } }
Shuts down this timer immediately, interrupting the wait state associated
with the current head of the task queue or the wait state internal to
the currently executing task, if any such state is currently in effect.

After this call, the timer has permanently entered the shutdown state;
attempting to schedule any new task or directly restart this timer will
result in an IllegalStateException. <p>

<b>Note:</b> If the integrity of work performed by a scheduled task
may be adversely affected by an unplanned interruption, it is the
responsibility of the task's implementation to deal correctly with the
possibility that this method is called while such work is in progress,
for instance by catching the InterruptedException, completing the work,
and then rethrowing the exception.