keith-turner commented on issue #1011: SyncCommitObserver should throw an 
exception if multiple methods called.
URL: https://github.com/apache/fluo/issues/1011#issuecomment-361649576
 
 
   The goal of this issue is to throw an exception if any of the methods 
`committed()`, `failed()`, `alreadyAcknowledged()`, or `commitFailed()` is 
called more than once.  Below are two possible ways to accomplish this.
   
   # Use synchronized
    * Make all methods synchronized
    * Drop all volatile, not needed with sync
    * Drop CountDownLatch and replace with Object wait and notify methods (can 
do this since methods are sync)
    * Add a boolean that tracks if one of the 4 methods was called.  For each 
method check the boolean and throw exception if set.  If not set, then set it.
   
   # Use AtomicBoolean
    * Add an AtomicBoolean that tracks if one of 4 methods were called
    * When a method is called, is compared and set on atomic boolean to change 
from false to true. If compare and set fails, it means something else called 
method so throw exception.
   
   For either method, Guava's `Preconditions.checkState()` method can be used.
   
   I posted this on helpwanted.
   
   
https://helpwanted.apache.org/task.html?a3862f6ea243e0003cb0992beb127c57598f80ef

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to