Timer purge - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Timer purge method.

This code example shows how to use the following methods:purge
	} 
 
	protected void removeTask(TimerTask task)
	{ 
		task.cancel();
		timer.purge();
	} 
 
	protected void kill() 
	{ 
		timer.cancel();
	} 
} 
6
CodeRank
This code example shows how to use the following methods:cancel, purge
 
        if (timerTask != null) {
            timerTask.cancel();
        } 
        if (timer != null) {
            timer.cancel();
            timer.purge();
        } 
    } 
 
    private String operatorName;
    private long curTx, curRx, preTx, preRx;
    private NetworkInfo networkInfo;
 
    private void getTrafficStats() { 
 
        curTx = TrafficStats.getUidTxBytes(mUid);
        curRx = TrafficStats.getUidRxBytes(mUid);
 
        networkInfo = connectivityManager.getActiveNetworkInfo();
6
CodeRank
This code example shows how to use the following methods:purge
 
    public static synchronized void cancel(Runnable task) {
        TimerTask ticket = TIMER_TASKS.remove(task);
        if (ticket != null) {
            ticket.cancel();
            CLOCK_DAEMON.purge();//remove cancelled TimerTasks
        } 
    } 
 
    public static void executeAfterDelay(final Runnable task, long redeliveryDelay) {
        TimerTask timerTask = new SchedulerTimerTask(task);
        CLOCK_DAEMON.schedule(timerTask, redeliveryDelay);
    } 
 
    public static void shutdown() { 
        CLOCK_DAEMON.cancel();
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:purge
    public void run() 
    { 
        Timer timer = _timer;
        if (timer != null)
        { 
            timer.purge();
            schedule(this, 1, TimeUnit.SECONDS);
        } 
    } 
 
    private static class SimpleTask extends TimerTask implements Task
    { 
        private final Runnable _task;
 
        private SimpleTask(Runnable runnable)
        { 
            _task = runnable;
        } 
 
        @Override 
6
CodeRank
This code example shows how to use the following methods:cancel, purge, schedule
        n = 0;
 
        if (output == null)
            return; 
 
        tick.cancel();
        tick.purge();
 
        output.stop();
        output.flush();
        output.close();
        output = null;
    } 
 
    public void set_speed(double speed) {
        /* This engine is equipped with an automatic gear box that 
         * switches gears when the RPM becomes too high or too low.  */ 
        double new_speed = Math.abs(speed);
        double accel = new_speed - this.speed;
        this.speed = new_speed;

6
CodeRank
This code example shows how to use the following methods:cancel, purge
	} 
	 
	@Override 
	public boolean cancel() { 
		this._task = null;
		this._timer.cancel();
		this._timer.purge();
		return super.cancel(); 
	} 
	 
	@Override 
	public void run() { 
		if (null != _task) _task.execute();
	} 
	 
	private Task _task;
	private Timer _timer;
} 
5
CodeRank
This code example shows how to use the following methods:cancel, purge
	}; 
	 
 
	public void delayedLock(int time) {
		if(lockTimer != null) {
			lockTimer.cancel();
			lockTimer.purge();
			lockTimer = null;
		} 
		 
		lockTimer = new Timer("ScreenLock-timer");
		 
		lockTimer.schedule(new LockTimerTask(), time);
	} 
	 
	 
	public void show() { 
		setVisibility(VISIBLE);
		if(activity != null) {
			Window win = activity.getWindow();
6
CodeRank
This code example shows how to use the following methods:purge
    } 
 
    protected void removeTask(TimerTask task)
    { 
        task.cancel();
        timer.purge();
    } 
 
    protected void kill() 
    { 
        timer.cancel();
    } 
} 
5
CodeRank
This code example shows how to use the following methods:cancel, purge
     * Start the Scheduler. This will create the thread of the Scheduler. 
     */ 
    @SuppressWarnings("nls") 
    public void start() { 
        if (timer != null) {
            timer.cancel();
            timer.purge();
        } 
        timer = new Timer("Illarion Scheduler", true);
        StoppableStorage.getInstance().add(this);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:purge
 
    public static synchronized void cancel(Runnable task) {
        TimerTask ticket = TIMER_TASKS.remove(task);
        if (ticket != null) {
            ticket.cancel();
            CLOCK_DAEMON.purge();//remove cancelled TimerTasks
        } 
    } 
 
    public static void executeAfterDelay(final Runnable task, long redeliveryDelay) {
        TimerTask timerTask = new SchedulerTimerTask(task);
        CLOCK_DAEMON.schedule(timerTask, redeliveryDelay);
    } 
 
    public static void shutdown() { 
        CLOCK_DAEMON.cancel();
    } 
 
} 
5
CodeRank

Related Timer purge Questions & Answers:

purge Method Overview
Removes all cancelled tasks from this timer's task queue.
See Code Examples for other Java 8 Timer Methods: