Author: ataylor
Date: 2010-09-29 03:17:51 -0400 (Wed, 29 Sep 2010)
New Revision: 9730
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
Log:
added list of allowed connectors when allowdirectconnections is used
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-29
07:16:46 UTC (rev 9729)
+++
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-09-29
07:17:51 UTC (rev 9730)
@@ -20,6 +20,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import org.hornetq.api.core.Pair;
@@ -98,6 +99,8 @@
private final TransportConfiguration connector;
private final boolean allowsDirectConnectionsOnly;
+
+ private final Set<TransportConfiguration> allowableConnections = new
HashSet<TransportConfiguration>();
public ClusterConnectionImpl(final ServerLocatorInternal serverLocator,
final TransportConfiguration connector,
@@ -140,9 +143,18 @@
}
// a cluster connection will connect to other nodes only if they are directly
connected
- // through a static list of connectors
- allowsDirectConnectionsOnly = (serverLocator.getStaticTransportConfigurations()
!= null);
- } else
+ // through a static list of connectors or broadcasting using UDP.
+ TransportConfiguration[] transportConfigurations =
serverLocator.getStaticTransportConfigurations();
+ allowsDirectConnectionsOnly = (transportConfigurations != null);
+ if(allowsDirectConnectionsOnly)
+ {
+ for (TransportConfiguration transportConfiguration :
transportConfigurations)
+ {
+ allowableConnections.add(transportConfiguration);
+ }
+ }
+ }
+ else
{
allowsDirectConnectionsOnly = false;
}
@@ -351,7 +363,7 @@
server.getClusterManager().notifyNodeUp(nodeID, sourceNodeID, connectorPair, last,
distance);
// if the node is more than 1 hop away, we do not create a bridge for direct
cluster connection
- if (allowsDirectConnectionsOnly && distance > 1)
+ if (allowsDirectConnectionsOnly && distance > 1 &&
!allowableConnections.contains(connectorPair.a))
{
return;
}