@Override public void unregisterAllServices() { for (JmDNS instance : jmdnsInstances) { instance.unregisterAllServices(); } }
public synchronized void stop() { jmdns.unregisterAllServices(); }
@Override public void unregisterAllServices() { synchronized (_services) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.unregisterAllServices(); } _services.clear(); } }
@Override public void unregisterAllServices() { activeServices.clear(); for (JmDNS instance : jmdnsInstances.values()) { instance.unregisterAllServices(); } }
@Override public void unregisterAllServices() { synchronized (_services) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.unregisterAllServices(); } _services.clear(); } }
@Override public void unregisterAllServices() { synchronized (_services) { for (JmDNS mDNS : _knownMDNS.values()) { mDNS.unregisterAllServices(); } _services.clear(); } }
@Override public void unregisterAllServices() { // We need to get the list out of the synchronized block to prevent dead locks final JmDNS[] dnsArray = this.getDNS(); synchronized (_services) { _services.clear(); for (JmDNS mDNS : dnsArray) { mDNS.unregisterAllServices(); } } }
public synchronized void setDiscoverable(boolean discoverable) throws IOException { if (this.discoverable != discoverable) { this.discoverable = discoverable; if (isAdvertising) { logger.info("Re-creating service due to change in discoverability to "+discoverable); jmdns.unregisterAllServices(); registerService(); } } }
public synchronized void setConfigurationIndex(int revision) throws IOException { if (this.configurationIndex != revision) { this.configurationIndex = revision; if (isAdvertising) { logger.info("Re-creating service due to change in configuration index to "+revision); jmdns.unregisterAllServices(); registerService(); } } }
public synchronized void advertise(String label, String mac, int port, int configurationIndex) throws Exception { if (isAdvertising) { throw new IllegalStateException("Homekit advertiser is already running"); } this.label = label; this.mac = mac; this.port = port; this.configurationIndex = configurationIndex; logger.info("Advertising accessory "+label); registerService(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { logger.info("Stopping advertising in response to shutdown."); jmdns.unregisterAllServices(); })); isAdvertising = true; }
public static void unregisterAllServices() { if (isServiceStopped.get() || getJmDNSservice() == null) { return; } getJmDNSservice().unregisterAllServices(); }
public static void unregisterAllServices() { if (isServiceStopped.get() || getJmDNSservice() == null) { return; } getJmDNSservice().unregisterAllServices(); }
/** * Close down jmdns. Release all resources and unregister all services. */ public void close() { if (state != DNSState.CANCELED) { synchronized (this) { // Synchronize only if we are not already in process to prevent dead locks // Stop JmDNS state = DNSState.CANCELED; // This protects against recursive calls unregisterAllServices(); disposeServiceCollectors(); // close socket closeMulticastSocket(); // Stop the timer timer.cancel(); // remove the shutdown hook if (shutdown != null) { Runtime.getRuntime().removeShutdownHook(shutdown); } } } }
/** * Shuts the AirReceiver down gracefully */ public static void onShutdown() { /* Close channels */ final ChannelGroupFuture allChannelsClosed = s_allChannels.close(); /* Stop all mDNS responders */ synchronized(s_jmDNSInstances) { for(final JmDNS jmDNS: s_jmDNSInstances) { try { jmDNS.unregisterAllServices(); s_logger.info("Unregistered all services on " + jmDNS.getInterface()); } catch (final IOException e) { s_logger.info("Failed to unregister some services"); } } } /* Wait for all channels to finish closing */ allChannelsClosed.awaitUninterruptibly(); /* Stop the ExecutorService */ ExecutorService.shutdown(); /* Release the OrderedMemoryAwareThreadPoolExecutor */ ChannelExecutionHandler.releaseExternalResources(); }
unregisterAllServices(); disposeServiceCollectors();
@Override protected void stopComponent() throws Exception { try { m_jmDNS.removeServiceListener(SERVICE_TYPE, m_jmDNSListener); } catch (Exception e) { logWarning("Exception while stopping", e); } try { m_jmDNS.unregisterAllServices(); } catch (Exception e) { logWarning("Exception while stopping", e); } try { m_jmDNS.close(); } catch (Exception e) { logWarning("Exception while stopping", e); } m_jmDNS = null; super.stopComponent(); }