Code example for TimerTask

Methods: cancel

0
        if (_running)
        { 
            if (_timer!=null)
                _timer.cancel();
            if (_task!=null)
                _task.cancel();
            if (getScanInterval() > 0) 
            { 
                _timer = newTimer();
                _task = newTimerTask();
                _timer.schedule(_task, 1000L*getScanInterval(),1000L*getScanInterval());
            } 
        } 
    } 
    /** 
     * Stop the scanning. 
     */ 
    public synchronized void stop () 
    { 
        if (_running)
        {