dcapwell commented on code in PR #3157:
URL: https://github.com/apache/cassandra/pull/3157#discussion_r1511779187


##########
src/java/org/apache/cassandra/service/accord/AccordStateCache.java:
##########
@@ -278,13 +303,36 @@ public Instance(
             this.nodeFactory = nodeFactory;
         }
 
+        public void register(Listener<K, V> l)
+        {
+            if (listeners == null)
+                listeners = new ArrayList<>();
+            listeners.add(l);
+        }
+
+        public void unregister(Listener<K, V> l)
+        {
+            if (listeners == null)
+                throw new AssertionError("No listeners exist");
+            if (!listeners.remove(l))
+                throw new AssertionError("Listener was not registered");
+            if (listeners.isEmpty())
+                listeners = null;
+        }
+
         public Stream<AccordCachingState<K, V>> stream()
         {
             return cache.entrySet().stream()
-                        .filter(e -> 
keyClass.isAssignableFrom(e.getKey().getClass()))

Review Comment:
   we were matching multiple instances due to CFK stuff having the same type 
key...



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