Code example for ScheduledFuture

Methods: cancel

0
 
	/** 
	 * Stop timed auto updates 
	 */ 
	public synchronized static void stopAutoUpdate() { 
		updateFuture.cancel(DONT_INTERRUPT_IF_RUNNING);
		updateFuture = null;
	} 
 
	/** 
	 * Start timed auto updates, or do nothing if already started. Next update 
	 * will be scheduled to run immediately if starting. 
	 */ 
	private synchronized static void startAutoUpdate() { 
		if (updateFuture == null) {
			Runnable task = new UpdateTask(reader);
			updateFuture = fScheduler.scheduleWithFixedDelay(task, 0,
					fDelayBetweenRuns, TimeUnit.SECONDS);
		} else { 
			startUpdate();