Code example for ScheduledExecutorService

Methods: scheduleWithFixedDelay

0
	 * 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(); 
		} 
	} 
	 
	private static boolean lastUpdateWorkedFlag=true;
	public synchronized static boolean lastUpdateWorked(){ 
		return lastUpdateWorkedFlag;
	} 
	public synchronized static void setLastUpdateWorked(boolean worked){
		lastUpdateWorkedFlag=worked;
	} 
 
}