Timer cancel - 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 cancel method.

This code example shows how to use the following methods:cancel
  public void start() { 
    this.timer.scheduleAtFixedRate(new MasterKeyRoller(), 0, rollingInterval);
  } 
 
  public void stop() { 
    this.timer.cancel();
  } 
 
  public synchronized void applicationMasterFinished( 
      ApplicationAttemptId appAttemptId) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Application finished, removing password for " + appAttemptId);
    } 
    this.passwords.remove(appAttemptId);
  } 
 
  private class MasterKeyRoller extends TimerTask {
    @Override 
    public void run() { 
      rollMasterKey(); 
8
CodeRank
This code example shows how to use the following methods:cancel
    this.timer.scheduleAtFixedRate(new MasterKeyRoller(), rollingInterval,
        rollingInterval);
  } 
 
  public void stop() { 
    this.timer.cancel();
  } 
 
  /** 
   * Creates a new master-key and sets it as the primary. 
   */ 
  @Private 
  public void rollMasterKey() { 
    super.writeLock.lock(); 
    try { 
      LOG.info("Rolling master-key for container-tokens");
      if (this.currentMasterKey == null) { // Setting up for the first time.
        this.currentMasterKey = createNewMasterKey();
      } else { 
        this.nextMasterKey = createNewMasterKey();
8
CodeRank
This code example shows how to use the following methods:cancel
	 * Finalizes the solo object. 
	 */   
 
	@Override 
	public void finalize() throws Throwable { 
		activitySyncTimer.cancel();
		try { 
			// Remove the monitor added during startup 
			if (activityMonitor != null) {
				inst.removeMonitor(activityMonitor);
				activityMonitor = null;
			} 
		} catch (Exception ignored) {}
		super.finalize(); 
	} 
 
	/** 
	 * All activites that have been opened are finished. 
	 */ 
 
8
CodeRank
This code example shows how to use the following methods:cancel
    	new Thread() { 
    		@Override 
    		public void run() { 
    			super.run(); 
 
    	    	timer.cancel(); 
    	    	servoRunner = false; 
    			try { 
    				servoThread.join(); 
    			} catch (InterruptedException e) { 
    				Log.e(LOG_TAG, e.getMessage()); 
    			} 
    		} 
    	}.start(); 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				seekBar.setEnabled(false); 
				toggleButton.setEnabled(false); 
				toggleButton.setChecked(false); 
7
CodeRank
This code example shows how to use the following methods:cancel
		timer.purge();
	} 
 
	protected void kill() 
	{ 
		timer.cancel();
	} 
} 
7
CodeRank
This code example shows how to use the following methods:cancel
    } 
  } 
 
  @Override 
  protected void die() { 
    timer.cancel();
    super.die(); 
  } 
 
  @Override 
  boolean ninja() { 
    return true; 
  } 
 
  private final class Logout extends TimerTask {
    @Override 
    public void run() { 
      writeLock.lock(); 
      try { 
        logout(); 
7
CodeRank
This code example shows how to use the following methods:cancel
     * Shutdown the purge task. 
     */ 
    public void shutdown() { 
        if (PurgeTaskStatus.STARTED == purgeTaskStatus) {
            LOG.info("Shutting down purge task."); 
            timer.cancel();
            purgeTaskStatus = PurgeTaskStatus.COMPLETED;
        } else { 
            LOG.warn("Purge task not started. Ignoring shutdown!"); 
        } 
    } 
 
    static class PurgeTask extends TimerTask {
        private File logsDir;
        private File snapsDir;
        private int snapRetainCount;
 
        public PurgeTask(File dataDir, File snapDir, int count) {
            logsDir = dataDir;
            snapsDir = snapDir;
6
CodeRank
This code example shows how to use the following methods:cancel
        TimerTask timerTask = new SchedulerTimerTask(task);
        CLOCK_DAEMON.schedule(timerTask, redeliveryDelay);
    } 
 
    public static void shutdown() { 
        CLOCK_DAEMON.cancel();
    } 
 
} 
7
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:cancel, schedule
public class CrashXCheckJni { 
 
    public static void main(String []s)
    { 
        final Dialog fd = new Dialog(new Frame(), true);
        Timer t = new Timer();
        t.schedule(new TimerTask() {
 
            public void run() { 
                System.out.println("RUNNING TASK");
                fd.setVisible(false);
                fd.dispose();
                System.out.println("FINISHING TASK");
            } 
        }, 3000L); 
 
        fd.setVisible(true);
        t.cancel();
        Util.waitForIdle(null); 
 

6
CodeRank

Related Timer cancel Questions & Answers:

cancel Method Overview
Terminates this timer, discarding any currently scheduled tasks.
See Code Examples for other Java 8 Timer Methods: