[hornetq-commits] JBoss hornetq SVN: r9105 - trunk/src/main/org/hornetq/core/cluster/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Apr 13 04:04:51 EDT 2010
Author: timfox
Date: 2010-04-13 04:04:49 -0400 (Tue, 13 Apr 2010)
New Revision: 9105
Modified:
trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-291
Modified: trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2010-04-13 06:53:59 UTC (rev 9104)
+++ trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2010-04-13 08:04:49 UTC (rev 9105)
@@ -75,7 +75,7 @@
private final int groupPort;
- private final Map<String, UniqueIDEntry> uniqueIDMap = new HashMap<String, UniqueIDEntry>();
+ private final Map<String, String> uniqueIDMap = new HashMap<String, String>();
private NotificationService notificationService;
@@ -221,77 +221,29 @@
}
}
- private static class UniqueIDEntry
- {
- String uniqueID;
-
- boolean changed;
-
- UniqueIDEntry(final String uniqueID)
- {
- this.uniqueID = uniqueID;
- }
-
- boolean isChanged()
- {
- return changed;
- }
-
- void setChanged()
- {
- changed = true;
- }
-
- String getUniqueID()
- {
- return uniqueID;
- }
-
- void setUniqueID(final String uniqueID)
- {
- this.uniqueID = uniqueID;
- }
- }
-
/*
* This is a sanity check to catch any cases where two different nodes are broadcasting the same node id either
* due to misconfiguration or problems in failover
*/
- private boolean uniqueIDOK(final String originatingNodeID, final String uniqueID)
+ private void checkUniqueID(final String originatingNodeID, final String uniqueID)
{
- UniqueIDEntry entry = uniqueIDMap.get(originatingNodeID);
+ String currentUniqueID = uniqueIDMap.get(originatingNodeID);
- if (entry == null)
+ if (currentUniqueID == null)
{
- entry = new UniqueIDEntry(uniqueID);
-
- uniqueIDMap.put(originatingNodeID, entry);
-
- return true;
+ uniqueIDMap.put(originatingNodeID, uniqueID);
}
else
{
- if (entry.getUniqueID().equals(uniqueID))
- {
- return true;
+ if (!currentUniqueID.equals(uniqueID))
+ {
+ log.warn("There are more than one servers on the network broadcasting the same node id. " +
+ "You will see this message exactly once (per node) if a node is restarted, in which case it can be safely " +
+ "ignored. But if it is logged continuously it means you really do have more than one node on the same network " +
+ "active concurrently with the same node id. This could occur if you have a backup node active at the same time as " +
+ "its live node.");
+ uniqueIDMap.put(originatingNodeID, uniqueID);
}
- else
- {
- // We allow one change - this might occur if one node fails over onto its backup which
- // has same node id but different unique id
- if (!entry.isChanged())
- {
- entry.setChanged();
-
- entry.setUniqueID(uniqueID);
-
- return true;
- }
- else
- {
- return false;
- }
- }
}
}
@@ -333,13 +285,8 @@
String uniqueID = buffer.readString();
- if (!uniqueIDOK(originatingNodeID, uniqueID))
- {
- DiscoveryGroupImpl.log.warn("There seem to be more than one broadcasters on the network broadcasting the same node id");
-
- continue;
- }
-
+ checkUniqueID(originatingNodeID, uniqueID);
+
if (nodeID.equals(originatingNodeID))
{
// Ignore traffic from own node
@@ -349,7 +296,7 @@
int size = buffer.readInt();
boolean changed = false;
-
+
synchronized (this)
{
for (int i = 0; i < size; i++)
More information about the hornetq-commits
mailing list