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


##########
accord-core/src/main/java/accord/impl/AbstractConfigurationService.java:
##########
@@ -204,44 +242,48 @@ public AbstractConfigurationService(Node.Id localId)
 
     protected abstract EpochHistory createEpochHistory();
 
-    protected synchronized EpochState getOrCreateEpochState(long epoch)
+    protected EpochState getOrCreateEpochState(long epoch)
     {
         return epochs.getOrCreate(epoch);
     }
 
     @Override
-    public synchronized void registerListener(Listener listener)
+    public void registerListener(Listener listener)
     {
         listeners.add(listener);
     }
 
-    public synchronized boolean isEmpty()
+    public boolean isEmpty()
     {
         return epochs.isEmpty();
     }
 
     @Override
-    public synchronized Topology currentTopology()
+    public Topology currentTopology()
     {
-        return epochs.topologyFor(epochs.lastReceived);
+        return epochs.topologyForLastReceived();
     }
 
     @Override
-    public synchronized Topology getTopologyForEpoch(long epoch)
+    public Topology getTopologyForEpoch(long epoch)
     {
         return epochs.topologyFor(epoch);
     }
 
     protected abstract void fetchTopologyInternal(long epoch);
 
+    @GuardedBy("this")
     private long maxRequestedEpoch;
     @Override
-    public synchronized void fetchTopologyForEpoch(long epoch)
+    public void fetchTopologyForEpoch(long epoch)
     {
-        if (epoch <= maxRequestedEpoch)
-            return;
+        synchronized (this)

Review Comment:
   this is the only state that collects the config service lock.  Accord uses 
this lock, so figure this is small enough that the overlap doesn't matter.
   
   Accord mostly uses the lock for disk state



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