RecordReaper.java
Go to the documentation of this file.
00001 // Copyright 2003-2005 Arthur van Hoff, Rick Blair
00002 // Licensed under Apache License version 2.0
00003 // Original license LGPL
00004 
00005 package javax.jmdns.impl.tasks;
00006 
00007 import java.util.Timer;
00008 import java.util.logging.Level;
00009 import java.util.logging.Logger;
00010 
00011 import javax.jmdns.impl.JmDNSImpl;
00012 import javax.jmdns.impl.constants.DNSConstants;
00013 
00017 public class RecordReaper extends DNSTask {
00018     static Logger logger = Logger.getLogger(RecordReaper.class.getName());
00019 
00023     public RecordReaper(JmDNSImpl jmDNSImpl) {
00024         super(jmDNSImpl);
00025     }
00026 
00027     /*
00028      * (non-Javadoc)
00029      * @see javax.jmdns.impl.tasks.DNSTask#getName()
00030      */
00031     @Override
00032     public String getName() {
00033         return "RecordReaper(" + (this.getDns() != null ? this.getDns().getName() : "") + ")";
00034     }
00035 
00036     /*
00037      * (non-Javadoc)
00038      * @see javax.jmdns.impl.tasks.DNSTask#start(java.util.Timer)
00039      */
00040     @Override
00041     public void start(Timer timer) {
00042         if (!this.getDns().isCanceling() && !this.getDns().isCanceled()) {
00043             timer.schedule(this, DNSConstants.RECORD_REAPER_INTERVAL, DNSConstants.RECORD_REAPER_INTERVAL);
00044         }
00045     }
00046 
00047     @Override
00048     public void run() {
00049         if (this.getDns().isCanceling() || this.getDns().isCanceled()) {
00050             return;
00051         }
00052         if (logger.isLoggable(Level.FINEST)) {
00053             logger.finest(this.getName() + ".run() JmDNS reaping cache");
00054         }
00055 
00056         // Remove expired answers from the cache
00057         // -------------------------------------
00058         this.getDns().cleanCache();
00059     }
00060 
00061 }


zeroconf_jmdns_suite
Author(s): Daniel Stonier
autogenerated on Thu Aug 27 2015 15:50:27