dcapwell commented on code in PR #65:
URL: https://github.com/apache/cassandra-accord/pull/65#discussion_r1309149238


##########
accord-core/src/main/java/accord/impl/InMemoryCommandStore.java:
##########
@@ -871,31 +903,41 @@ public static class Synchronized extends 
InMemoryCommandStore
     {
         Runnable active = null;
         final Queue<Runnable> queue = new ConcurrentLinkedQueue<>();
+        private final AtomicBoolean running = new AtomicBoolean(false);
 
         public Synchronized(int id, NodeTimeService time, Agent agent, 
DataStore store, ProgressLog.Factory progressLogFactory, EpochUpdateHolder 
epochUpdateHolder)
         {
             super(id, time, agent, store, progressLogFactory, 
epochUpdateHolder);
         }
 
-        private synchronized void maybeRun()
+        private void maybeRun()
         {
-            if (active != null)
+            if (!running.compareAndSet(false, true))
                 return;
-
-            active = queue.poll();
-            while (active != null)
+            synchronized (this)

Review Comment:
   was not 100% sure this was fully needed given the single threaded nature of 
the work, but felt best to not try to change the locking too much



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to