activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r357017 - /incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java
Date Thu, 15 Dec 2005 14:13:18 GMT
Author: jstrachan
Date: Thu Dec 15 06:13:14 2005
New Revision: 357017

URL: http://svn.apache.org/viewcvs?rev=357017&view=rev
Log:
make the agent more resilient to ordering; whether a service is registered before starting
or started first etc. We seem to have both in our code base

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java?rev=357017&r1=357016&r2=357017&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/transport/discovery/rendezvous/RendezvousDiscoveryAgent.java
Thu Dec 15 06:13:14 2005
@@ -75,9 +75,8 @@
             type += ".";
         }
         try {
-            if (jmdns == null) {
-                jmdns = createJmDNS();
-            }
+            // force lazy construction
+            getJmdns();
             if (listener!=null) {
                 log.info("Discovering service of type: " +type);
                 jmdns.addServiceListener(type, this);
@@ -111,12 +110,9 @@
     }
     
     public void registerService(String name) throws IOException {
-        if (jmdns == null) {
-            throw new IllegalStateException("Not started.");
-        }
         ServiceInfo si = createServiceInfo(name, new HashMap());
         serviceInfos.add(si);
-        jmdns.registerService(si);
+        getJmdns().registerService(si);
     }
 
 
@@ -166,7 +162,10 @@
         this.weight = weight;
     }
 
-    public JmDNS getJmdns() {
+    public JmDNS getJmdns() throws IOException {
+        if (jmdns == null) {
+            jmdns = createJmDNS();
+        }
         return jmdns;
     }
 



Mime
View raw message