[jboss-jira] [JBoss JIRA] Commented: (JGRP-707) stats logic NPE in NAKACK
Bela Ban (JIRA)
jira-events at lists.jboss.org
Wed Mar 12 06:02:15 EDT 2008
[ http://jira.jboss.com/jira/browse/JGRP-707?page=comments#action_12402378 ]
Bela Ban commented on JGRP-707:
-------------------------------
Fixed this with ConcurrentHashMap. However, for HashMaps, I didn't change it, e.g.:
private static void updateStats(HashMap<Address,StatsEntry> map, Address key, int req, int rsp, int missing) {
StatsEntry entry=map.get(key);
if(entry == null) {
entry=new StatsEntry();
map.put(key, entry);
}
entry.xmit_reqs+=req;
entry.xmit_rsps+=rsp;
entry.missing_msgs_rcvd+=missing;
}
Here, different threads might write to different Entries, but since this is only for stats and only on initial startup, this is fine. We'll just lose a few data points...
> stats logic NPE in NAKACK
> -------------------------
>
> Key: JGRP-707
> URL: http://jira.jboss.com/jira/browse/JGRP-707
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 2.6.1
> Reporter: Gray Watson
> Assigned To: Bela Ban
> Priority: Minor
> Fix For: 2.6.3, 2.7
>
> Attachments: NAKACK.java.patch
>
>
> In the code for NAKACK, the first packet which is recorded as part of the stats for an address throws NPE.
> StatsEntry entry=map.get(key);
> if(entry == null) {
> entry = new StatsEntry();
> entry = map.putIfAbsent(key, entry);
> // ^^^^ this can return null if key does not exist
> }
> entry.xmit_reqs+=req;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list