szetszwo commented on PR #696:
URL: https://github.com/apache/ratis/pull/696#issuecomment-1197672102

   > ... can we add some comments about thread-safety in the StateMachine class?
   
   This is a very good suggestion.  Let's me file a JIRA for adding it.
   
   > ...  I'm not quite sure about that, does Ratis require user to implement a 
thread safe class of StateMachine?
   
   Yes, it is because a state machine should support concurrent read/write.
   
   > ...  For example, in the counter example, we have AtomicInteger counter, 
will a basic integer work?
   
   If the counter is declared as int, then read may not see the most updated 
value since the query(..) method is not synchronized.  Of course, it would work 
if we add `synchronized` to query(..) but query(..) will then unnecessarily 
block the other methods.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to