Author: clebert.suconic(a)jboss.com
Date: 2011-09-12 18:32:45 -0400 (Mon, 12 Sep 2011)
New Revision: 11333
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
Log:
tweaks on discovery
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-09-12
20:59:11 UTC (rev 11332)
+++
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2011-09-12
22:32:45 UTC (rev 11333)
@@ -1401,6 +1401,13 @@
for (DiscoveryEntry entry : newConnectors)
{
this.initialConnectors[count++] = entry.getConnector();
+
+ if (topology != null && topology.getMember(entry.getNodeID()) == null)
+ {
+ TopologyMember member = new TopologyMember(entry.getConnector(), null);
+ // on this case we set it as zero as any update coming from server should be
accepted
+ topology.updateMember(0, entry.getNodeID(), member);
+ }
}
if (clusterConnection && !receivedTopology &&
initialConnectors.length > 0)
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-09-12
20:59:11 UTC (rev 11332)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-09-12
22:32:45 UTC (rev 11333)
@@ -23,7 +23,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClusterTopologyListener;
import org.hornetq.core.logging.Logger;
@@ -246,33 +245,36 @@
log.trace(this + "::prepare to send " + nodeId + " to " +
copy.size() + " elements");
}
- execute(new Runnable()
+ if (copy.size() > 0)
{
- public void run()
+ execute(new Runnable()
{
- for (ClusterTopologyListener listener : copy)
+ public void run()
{
- if (Topology.log.isTraceEnabled())
+ for (ClusterTopologyListener listener : copy)
{
- Topology.log.trace(Topology.this + " informing " +
- listener +
- " about node up = " +
- nodeId +
- " connector = " +
- memberToSend.getConnector());
+ if (Topology.log.isTraceEnabled())
+ {
+ Topology.log.trace(Topology.this + " informing " +
+ listener +
+ " about node up = " +
+ nodeId +
+ " connector = " +
+ memberToSend.getConnector());
+ }
+
+ try
+ {
+ listener.nodeUP(uniqueEventID, nodeId, memberToSend.getConnector(),
false);
+ }
+ catch (Throwable e)
+ {
+ log.warn(e.getMessage(), e);
+ }
}
-
- try
- {
- listener.nodeUP(uniqueEventID, nodeId, memberToSend.getConnector(),
false);
- }
- catch (Throwable e)
- {
- log.warn(e.getMessage(), e);
- }
}
- }
- });
+ });
+ }
}
/**
Show replies by date