hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "JongYoon Lim (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HAMA-971) An increment to a volatile field isn't atomic
Date Fri, 28 Aug 2015 08:47:45 GMT
JongYoon Lim created HAMA-971:

             Summary: An increment to a volatile field isn't atomic
                 Key: HAMA-971
                 URL: https://issues.apache.org/jira/browse/HAMA-971
             Project: Hama
          Issue Type: Bug
          Components: bsp core
            Reporter: JongYoon Lim
            Priority: Minor

I found a defect from FindBugs Analysis.
// AsyncRcvdMsgCheckpointImpl.java
volatile private long checkpointMessageCount;

// Server.java
private volatile int rpcCount = 0; // number of outstanding rpcs

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. 

This message was sent by Atlassian JIRA

View raw message