ServiceInfoImpl resolveServiceInfo(String type, String name, String subtype, boolean persistent) { this.cleanCache(); String loType = type.toLowerCase(); this.registerServiceType(type); if (_serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null) { this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHONEOUS); } // Check if the answer is in the cache. final ServiceInfoImpl info = this.getServiceInfoFromCache(type, name, subtype, persistent); // We still run the resolver to do the dispatch but if the info is already there it will quit immediately this.startServiceInfoResolver(info); return info; }
ServiceInfoImpl resolveServiceInfo(String type, String name, String subtype, boolean persistent) { this.cleanCache(); String loType = type.toLowerCase(); this.registerServiceType(type); if (_serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null) { this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHONEOUS); } // Check if the answer is in the cache. final ServiceInfoImpl info = this.getServiceInfoFromCache(type, name, subtype, persistent); // We still run the resolver to do the dispatch but if the info is already there it will quit immediately this.startServiceInfoResolver(info); return info; }
ServiceInfoImpl resolveServiceInfo(String type, String name, String subtype, boolean persistent) { this.cleanCache(); String loType = type.toLowerCase(); this.registerServiceType(type); if (_serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null) { this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHRONOUS); } // Check if the answer is in the cache. final ServiceInfoImpl info = this.getServiceInfoFromCache(type, name, subtype, persistent); // We still run the resolver to do the dispatch but if the info is already there it will quit immediately this.startServiceInfoResolver(info); return info; }
ServiceInfoImpl resolveServiceInfo(String type, String name, String subtype, boolean persistent) { this.cleanCache(); String loType = type.toLowerCase(); this.registerServiceType(type); if (_serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null) { this.addServiceListener(loType, _serviceCollectors.get(loType), ListenerStatus.SYNCHONEOUS); } // Check if the answer is in the cache. final ServiceInfoImpl info = this.getServiceInfoFromCache(type, name, subtype, persistent); // We still run the resolver to do the dispatch but if the info is already there it will quit immediately this.startServiceInfoResolver(info); return info; }
@Override public void run() { if (this.getDns().isCanceling() || this.getDns().isCanceled()) { return; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + ".run() JmDNS reaping cache"); } // Remove expired answers from the cache // ------------------------------------- this.getDns().cleanCache(); }
@Override public void run() { if (this.getDns().isCanceling() || this.getDns().isCanceled()) { return; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + ".run() JmDNS reaping cache"); } // Remove expired answers from the cache // ------------------------------------- this.getDns().cleanCache(); }
@Override public void run() { if (this.getDns().isCanceling() || this.getDns().isCanceled()) { return; } if (logger.isLoggable(Level.FINEST)) { logger.finest(this.getName() + ".run() JmDNS reaping cache"); } // Remove expired answers from the cache // ------------------------------------- this.getDns().cleanCache(); }
/** * {@inheritDoc} */ @Override public ServiceInfo[] list(String type, long timeout) { this.cleanCache(); // Implementation note: The first time a list for a given type is // requested, a ServiceCollector is created which collects service // infos. This greatly speeds up the performance of subsequent calls // to this method. The caveats are, that 1) the first call to this // method for a given type is slow, and 2) we spawn a ServiceCollector // instance for each service type which increases network traffic a // little. String loType = type.toLowerCase(); boolean newCollectorCreated = false; if (this.isCanceling() || this.isCanceled()) { return new ServiceInfo[0]; } ServiceCollector collector = _serviceCollectors.get(loType); if (collector == null) { newCollectorCreated = _serviceCollectors.putIfAbsent(loType, new ServiceCollector(type)) == null; collector = _serviceCollectors.get(loType); if (newCollectorCreated) { this.addServiceListener(type, collector, ListenerStatus.SYNCHRONOUS); } } logger.debug("{}-collector: {}", this.getName(), collector); // At this stage the collector should never be null but it keeps findbugs happy. return (collector != null ? collector.list(timeout) : new ServiceInfo[0]); }
@Override public void run() { if (this.getDns().isCanceling() || this.getDns().isCanceled()) { return; } logger.trace("{}.run() JmDNS reaping cache", this.getName()); // Remove expired answers from the cache // ------------------------------------- this.getDns().cleanCache(); }