Details
-
Bug
-
Status: Patch Available
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I found a defect from FindBugs Analysis.
// AsyncRcvdMsgCheckpointImpl.java volatile private long checkpointMessageCount; ... ++checkpointMessageCount;
// Server.java private volatile int rpcCount = 0; // number of outstanding rpcs ... rpcCount--; rpcCount++;
This code increments a volatile field. Increments of volatile fields aren't atomic. If more than one thread is incrementing the field at the same time, increments could be lost.
I think AtomicInteger and AtomicLong can be used instead of volatile fields.