From 13270e4e74fa501d2f47120c72988e761ac4fc12 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Wed, 31 Oct 2012 17:50:03 +0000 Subject: [PATCH] AMQ-4056 - ensure we do a close git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1404271 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/discovery/zeroconf/JmDNSFactory.java | 2 +- .../transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java index 08f61bca29..6913693201 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java @@ -46,7 +46,7 @@ public final class JmDNSFactory { return tracker.jmDNS; } - static synchronized boolean onClose(InetAddress address, JmDNS dns) { + static synchronized boolean onClose(InetAddress address) { UsageTracker tracker = registry.get(address); if (tracker != null) { if (tracker.count.decrementAndGet() == 0) { diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java index 77fc9f3f9c..714ca39b14 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java @@ -92,7 +92,9 @@ public class ZeroconfDiscoveryAgent implements DiscoveryAgent, ServiceListener { Thread thread = new Thread() { public void run() { try { - JmDNSFactory.onClose(getLocalAddress(), closeTarget); + if (JmDNSFactory.onClose(getLocalAddress())) { + closeTarget.close(); + }; } catch (IOException e) { LOG.debug("Error closing JmDNS " + getLocalhost() + ". This exception will be ignored.", e); }