01: package org.shiftone.cache.util.reaper;
02:
03: import java.util.TimerTask;
04:
05: /**
06: * Class CacheReaperTask
07: *
08: *
09: * @author <a href="mailto:jeff@shiftone.org">Jeff Drost</a>
10: * @version $Revision: 1.1 $
11: */
12: class CacheReaperTask extends TimerTask {
13:
14: private static long instanceCounter = 0;
15: private static final long instanceNumber = (instanceCounter++);
16:
17: /// private static final Logger LOG = Logger.getLogger(CacheReaperTask.class);
18: ReapableCache cache = null;
19:
20: /**
21: * Constructor CacheReaperTask
22: *
23: *
24: * @param cache
25: * @param key
26: */
27: public CacheReaperTask(ReapableCache cache) {
28:
29: /// LOG.debug("new CacheReaperTask( " + cache + " )");
30: this .cache = cache;
31: }
32:
33: /**
34: * Method run
35: */
36: public void run() {
37:
38: String threadName = Thread.currentThread().getName();
39:
40: Thread.currentThread().setName("REAPER for " + instanceNumber);
41:
42: synchronized (cache) {
43: cache.removeExpiredElements();
44: }
45:
46: Thread.currentThread().setName(threadName);
47: }
48: }
|