1
2
3
4
5 package javax.jmdns.impl.tasks;
6
7 import java.util.Timer;
8 import java.util.logging.Level;
9 import java.util.logging.Logger;
10
11 import javax.jmdns.impl.JmDNSImpl;
12 import javax.jmdns.impl.constants.DNSConstants;
13
14
15
16
17 public class RecordReaper extends DNSTask {
18 static Logger logger = Logger.getLogger(RecordReaper.class.getName());
19
20
21
22
23 public RecordReaper(JmDNSImpl jmDNSImpl) {
24 super(jmDNSImpl);
25 }
26
27
28
29
30
31 @Override
32 public String getName() {
33 return "RecordReaper(" + (this.getDns() != null ? this.getDns().getName() : "") + ")";
34 }
35
36
37
38
39
40 @Override
41 public void start(Timer timer) {
42 if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
43 timer.schedule(this, DNSConstants.RECORD_REAPER_INTERVAL, DNSConstants.RECORD_REAPER_INTERVAL);
44 }
45 }
46
47 @Override
48 public void run() {
49 if (this.getDns().isCanceling() || this.getDns().isCanceled()) {
50 return;
51 }
52 if (logger.isLoggable(Level.FINEST)) {
53 logger.finest(this.getName() + ".run() JmDNS reaping cache");
54 }
55
56
57
58 this.getDns().cleanCache();
59 }
60
61 }