/** *

See this IBM article for information about InterruptedException and how I handled * it in this method. * * Allowing a Thread to end * *

* * @noinspection InfiniteLoopStatement * @see Thread#run() */ public void run() { log.debug("Starting thread to purge expired objects from cache every " + (purgeTimeMilliseconds / 1000) + " seconds"); while (!Thread.currentThread().isInterrupted()) { log.trace("thread executing purgeExpired"); cacheService.purgeExpired(); try { sleep(purgeTimeMilliseconds); } catch (InterruptedException e) { /** * @see http://www-128.ibm.com/developerworks/java/library/j-jtp05236.html#code5 * Allow this thread to end */ } } }