Code example for ScheduledExecutorService

Methods: scheduleWithFixedDelay

0
		long delay = toMilliseconds(this.delayInDays);
 
		//final ExpiredTokenCleanTask expiredTokenCleanTask = new ExpiredTokenCleanTask(); 
		expiredTokenCleanTask.setDelayInMillisecconds(delay);
		 
		this.scheduler.scheduleWithFixedDelay(expiredTokenCleanTask, 0, delay, TimeUnit.MILLISECONDS);
		 
		if(LOG.isDebugEnabled()){
			LOG.debug("was scheduled - delay (days):" + delayInDays  );
		} 
	} 
 
 
	/** 
	 * Converts the days to millisecconds 
	 *  
	 * @param delayInDays 
	 * @return the delay days in milliseconds  
	 */ 
	private static long toMilliseconds(int delayInDays) {
Connect your IDE to all the code out there  Get Codota for Java