You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by da...@apache.org on 2012/09/18 10:44:42 UTC

svn commit: r1387052 - in /activemq/trunk: ./ activemq-core/ activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ activemq-jmdns_1.0/ activemq-karaf/src/main/resources/ assembly/ assembly/src/main/descriptors/

Author: davsclaus
Date: Tue Sep 18 08:44:42 2012
New Revision: 1387052

URL: http://svn.apache.org/viewvc?rev=1387052&view=rev
Log:
AMQ-4056: Upgraded jmDNS to 3.4.1, and removed old obsolte activemq-jmdns module that is no longer needed.

Removed:
    activemq/trunk/activemq-jmdns_1.0/
Modified:
    activemq/trunk/activemq-core/pom.xml
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java
    activemq/trunk/activemq-karaf/src/main/resources/features.xml
    activemq/trunk/assembly/pom.xml
    activemq/trunk/assembly/src/main/descriptors/common-bin.xml
    activemq/trunk/pom.xml

Modified: activemq/trunk/activemq-core/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/pom.xml?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/activemq-core/pom.xml (original)
+++ activemq/trunk/activemq-core/pom.xml Tue Sep 18 08:44:42 2012
@@ -38,6 +38,7 @@
       javax.annotation*;resolution:=optional,
       javax.transaction*;resolution:=optional,
       javax.security*;resolution:=optional,
+      javax.jmdns*;resolution:=optional,
       org.codehaus.jettison*;resolution:=optional,
       org.apache.activeio*;resolution:=optional,
       org.apache.camel*;resolution:=optional,
@@ -219,8 +220,8 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-jmdns_1.0</artifactId>
+      <groupId>javax.jmdns</groupId>
+      <artifactId>jmdns</artifactId>
       <optional>true</optional>
     </dependency>
     <dependency>

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/JmDNSFactory.java Tue Sep 18 08:44:42 2012
@@ -21,7 +21,7 @@ import java.net.InetAddress;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.activemq.jmdns.JmDNS;
+import javax.jmdns.JmDNS;
 
 public final class JmDNSFactory {
 
@@ -39,20 +39,14 @@ public final class JmDNSFactory {
         UsageTracker tracker = registry.get(address);
         if (tracker == null) {
             tracker = new UsageTracker();
-            tracker.jmDNS = new JmDNS(address) {
-                public void close() {
-                    if (onClose(address)) {
-                        super.close();
-                    }
-                }
-            };
+            tracker.jmDNS = JmDNS.create(address);
             registry.put(address, tracker);
         }
         tracker.count.incrementAndGet();
         return tracker.jmDNS;
     }
 
-    static synchronized boolean onClose(InetAddress address) {
+    static synchronized boolean onClose(InetAddress address, JmDNS dns) {
         UsageTracker tracker = registry.get(address);
         if (tracker != null) {
             if (tracker.count.decrementAndGet() == 0) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf/ZeroconfDiscoveryAgent.java Tue Sep 18 08:44:42 2012
@@ -23,11 +23,10 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.activemq.jmdns.JmDNS;
-import org.apache.activemq.jmdns.ServiceEvent;
-import org.apache.activemq.jmdns.ServiceInfo;
-import org.apache.activemq.jmdns.ServiceListener;
+import javax.jmdns.JmDNS;
+import javax.jmdns.ServiceEvent;
+import javax.jmdns.ServiceInfo;
+import javax.jmdns.ServiceListener;
 
 import org.apache.activemq.command.DiscoveryEvent;
 import org.apache.activemq.transport.discovery.DiscoveryAgent;
@@ -46,7 +45,7 @@ import org.slf4j.LoggerFactory;
 public class ZeroconfDiscoveryAgent implements DiscoveryAgent, ServiceListener {
     private static final Logger LOG = LoggerFactory.getLogger(ZeroconfDiscoveryAgent.class);
 
-    private static final String TYPE_SUFFIX = "ActiveMQ-4.";
+    private static final String TYPE_SUFFIX = "ActiveMQ-5.";
 
     private JmDNS jmdns;
     private InetAddress localAddress;
@@ -92,7 +91,11 @@ public class ZeroconfDiscoveryAgent impl
             final JmDNS closeTarget = jmdns;
             Thread thread = new Thread() {
                 public void run() {
-                    closeTarget.close();
+                    try {
+                        JmDNSFactory.onClose(getLocalAddress(), closeTarget);
+                    } catch (IOException e) {
+                        LOG.debug("Error closing JmDNS " + getLocalhost() + ". This exception will be ignored.", e);
+                    }
                 }
             };
 
@@ -200,7 +203,7 @@ public class ZeroconfDiscoveryAgent impl
         if (LOG.isDebugEnabled()) {
             LOG.debug("Registering service type: " + type + " name: " + name + " details: " + map);
         }
-        return new ServiceInfo(type, name + "." + type, port, weight, priority, "");
+        return ServiceInfo.create(type, name + "." + type, port, weight, priority, "");
     }
 
     protected JmDNS createJmDNS() throws IOException {

Modified: activemq/trunk/activemq-karaf/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/resources/features.xml?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/src/main/resources/features.xml (original)
+++ activemq/trunk/activemq-karaf/src/main/resources/features.xml Tue Sep 18 08:44:42 2012
@@ -75,6 +75,7 @@
         <bundle>mvn:org.apache.httpcomponents/httpcore-osgi/${httpclient-version}</bundle>
         <bundle>mvn:org.apache.httpcomponents/httpclient-osgi/${httpclient-version}</bundle>
         <bundle>mvn:org.springframework/spring-oxm/${spring-version}</bundle>
+        <bundle>mvn:javax.jmdns/jmdns/${jmdns-version}</bundle>
     </feature>
 
     <feature name="activemq-camel" version="${activemq-version}" resolver="(obr)">

Modified: activemq/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/pom.xml?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/assembly/pom.xml (original)
+++ activemq/trunk/assembly/pom.xml Tue Sep 18 08:44:42 2012
@@ -158,8 +158,8 @@
       <artifactId>jaxp-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>activemq-jmdns_1.0</artifactId>
+      <groupId>javax.jmdns</groupId>
+      <artifactId>jmdns</artifactId>
     </dependency>
     <dependency>
       <groupId>com.thoughtworks.xstream</groupId>

Modified: activemq/trunk/assembly/src/main/descriptors/common-bin.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/common-bin.xml?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/assembly/src/main/descriptors/common-bin.xml (original)
+++ activemq/trunk/assembly/src/main/descriptors/common-bin.xml Tue Sep 18 08:44:42 2012
@@ -138,7 +138,6 @@
         <include>${pom.groupId}:activemq-xmpp</include>
         <include>${pom.groupId}:activemq-spring</include>
         <include>${pom.groupId}:activeio-core</include>
-        <include>${pom.groupId}:activemq-jmdns_1.0</include>
         <include>commons-beanutils:commons-beanutils</include>
         <include>commons-collections:commons-collections</include>
         <include>commons-httpclient:commons-httpclient</include>
@@ -168,6 +167,7 @@
         <include>org.apache.velocity:velocity</include>
         <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.josql</include>
         <include>org.jasypt:jasypt</include>
+        <include>javax.jmdns:jmdns</include>
         <!-- leveldb -->
         <include>org.fusesource.fuse-extra:fusemq-leveldb</include>
         <include>org.fusesource.hawtbuf:hawtbuf</include>

Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=1387052&r1=1387051&r2=1387052&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Tue Sep 18 08:44:42 2012
@@ -73,6 +73,7 @@
     <jasypt-version>1.9.0</jasypt-version>
     <jdom-version>1.0</jdom-version>
     <jetty-version>7.6.5.v20120716</jetty-version>
+    <jmdns-version>3.4.1</jmdns-version>
     <jsp-version>2.1.v20100127</jsp-version>
     <jstl-version>1.1.2</jstl-version>
     <jettison-version>1.3.2</jettison-version>
@@ -204,7 +205,6 @@
     <module>activemq-web-console</module>
     <module>activemq-xmpp</module>
     <module>assembly</module>
-    <module>activemq-jmdns_1.0</module>
     <module>kahadb</module>
   </modules>
 
@@ -248,11 +248,6 @@
       </dependency>
       <dependency>
         <groupId>org.apache.activemq</groupId>
-        <artifactId>activemq-jmdns_1.0</artifactId>
-        <version>${activemq-version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.activemq</groupId>
         <artifactId>activemq-pool</artifactId>
         <version>${activemq-version}</version>
       </dependency>
@@ -479,6 +474,14 @@
         <optional>true</optional>
       </dependency>
 
+      <!-- zeroconf transport -->
+      <dependency>
+        <groupId>javax.jmdns</groupId>
+        <artifactId>jmdns</artifactId>
+        <version>${jmdns-version}</version>
+        <optional>true</optional>
+      </dependency>
+
       <!-- For jsvc support -->
       <dependency>
         <groupId>commons-daemon</groupId>