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


##########
accord-core/src/main/java/accord/impl/AbstractConfigurationService.java:
##########
@@ -45,15 +48,16 @@ public abstract class 
AbstractConfigurationService<EpochState extends AbstractCo
 
     protected final EpochHistory epochs = createEpochHistory();
 
-    protected final List<Listener> listeners = new ArrayList<>();
+    protected final List<Listener> listeners = new CopyOnWriteArrayList<>();

Review Comment:
   there are now 2 different types of locking in this class: `listeners` that 
use the copy-on-write, and `epochs` which does sync on the class.
   
   One of the reasons to make this `CopyOnWrite` is that its accessed by 
different threads (register, caller) and this is a simple way to make sure its 
safe without needing this class to manage the locks for it (before we did class 
level sync)



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