fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] keith-turner commented on issue #1011: SyncCommitObserver should throw an exception if multiple methods called.
Date Thu, 01 Jan 1970 00:00:00 GMT
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).  When using java wait, it should always call in a loop.  The while loop
could call wait while the new boolean is not set.
    * 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, use compare 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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message