Clover Coverage Report - JmDNS 3.4.1
Coverage timestamp: Thu Aug 25 2011 13:06:33 CEST
../../../../img/srcFileCovDistChart6.png 31% of files have more coverage
9   61   10   2.25
8   31   1.11   4
4     2.5  
1    
 
  RecordReaper       Line # 17 9 0% 10 9 57.1% 0.5714286
 
  (21)
 
1    // Copyright 2003-2005 Arthur van Hoff, Rick Blair
2    // Licensed under Apache License version 2.0
3    // Original license LGPL
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    * Periodically removes expired entries from the cache.
16    */
 
17    public class RecordReaper extends DNSTask {
18    static Logger logger = Logger.getLogger(RecordReaper.class.getName());
19   
20    /**
21    * @param jmDNSImpl
22    */
 
23  29 toggle public RecordReaper(JmDNSImpl jmDNSImpl) {
24  29 super(jmDNSImpl);
25    }
26   
27    /*
28    * (non-Javadoc)
29    * @see javax.jmdns.impl.tasks.DNSTask#getName()
30    */
 
31  0 toggle @Override
32    public String getName() {
33  0 return "RecordReaper(" + (this.getDns() != null ? this.getDns().getName() : "") + ")";
34    }
35   
36    /*
37    * (non-Javadoc)
38    * @see javax.jmdns.impl.tasks.DNSTask#start(java.util.Timer)
39    */
 
40  29 toggle @Override
41    public void start(Timer timer) {
42  29 if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
43  29 timer.schedule(this, DNSConstants.RECORD_REAPER_INTERVAL, DNSConstants.RECORD_REAPER_INTERVAL);
44    }
45    }
46   
 
47  51 toggle @Override
48    public void run() {
49  49 if (this.getDns().isCanceling() || this.getDns().isCanceled()) {
50  0 return;
51    }
52  48 if (logger.isLoggable(Level.FINEST)) {
53  0 logger.finest(this.getName() + ".run() JmDNS reaping cache");
54    }
55   
56    // Remove expired answers from the cache
57    // -------------------------------------
58  47 this.getDns().cleanCache();
59    }
60   
61    }