mirror of https://github.com/apache/activemq.git
AMQ-4056 - ensure we do a close
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1404271 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
90beb3fb7d
commit
13270e4e74
|
@ -46,7 +46,7 @@ public final class JmDNSFactory {
|
||||||
return tracker.jmDNS;
|
return tracker.jmDNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static synchronized boolean onClose(InetAddress address, JmDNS dns) {
|
static synchronized boolean onClose(InetAddress address) {
|
||||||
UsageTracker tracker = registry.get(address);
|
UsageTracker tracker = registry.get(address);
|
||||||
if (tracker != null) {
|
if (tracker != null) {
|
||||||
if (tracker.count.decrementAndGet() == 0) {
|
if (tracker.count.decrementAndGet() == 0) {
|
||||||
|
|
|
@ -92,7 +92,9 @@ public class ZeroconfDiscoveryAgent implements DiscoveryAgent, ServiceListener {
|
||||||
Thread thread = new Thread() {
|
Thread thread = new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
JmDNSFactory.onClose(getLocalAddress(), closeTarget);
|
if (JmDNSFactory.onClose(getLocalAddress())) {
|
||||||
|
closeTarget.close();
|
||||||
|
};
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.debug("Error closing JmDNS " + getLocalhost() + ". This exception will be ignored.", e);
|
LOG.debug("Error closing JmDNS " + getLocalhost() + ". This exception will be ignored.", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue