Author: clebert.suconic(a)jboss.com
Date: 2011-11-10 16:11:28 -0500 (Thu, 10 Nov 2011)
New Revision: 11686
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
Log:
JBPAPP-7273 - Fixing NPE
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-11-10
11:08:03 UTC (rev 11685)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-11-10
21:11:28 UTC (rev 11686)
@@ -60,7 +60,7 @@
*/
private final Map<String, TopologyMember> topology = new
ConcurrentHashMap<String, TopologyMember>();
- private transient final Map<String, Long> mapDelete = new
ConcurrentHashMap<String, Long>();
+ private transient Map<String, Long> mapDelete;
public Topology(final Object owner)
{
@@ -158,7 +158,7 @@
public boolean updateMember(final long uniqueEventID, final String nodeId, final
TopologyMember memberInput)
{
- Long deleteTme = mapDelete.get(nodeId);
+ Long deleteTme = getMapDelete().get(nodeId);
if (deleteTme != null && uniqueEventID < deleteTme)
{
log.debug("Update uniqueEvent=" + uniqueEventID +
@@ -306,7 +306,7 @@
}
else
{
- mapDelete.put(nodeId, uniqueEventID);
+ getMapDelete().put(nodeId, uniqueEventID);
member = topology.remove(nodeId);
}
}
@@ -536,4 +536,13 @@
}
}
+ private synchronized Map<String, Long> getMapDelete()
+ {
+ if (mapDelete == null)
+ {
+ mapDelete = new ConcurrentHashMap<String, Long>();
+ }
+ return mapDelete;
+ }
+
}