cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #428: CASSANDRA-15505
Date Thu, 23 Jan 2020 01:50:55 GMT
dcapwell commented on a change in pull request #428: CASSANDRA-15505 

 File path: test/distributed/org/apache/cassandra/distributed/impl/
 @@ -18,65 +18,48 @@
 package org.apache.cassandra.distributed.impl;
+import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.cassandra.distributed.api.IInstance;
+import org.apache.cassandra.distributed.api.IMatcher;
+import org.apache.cassandra.distributed.api.IMessage;
 import org.apache.cassandra.distributed.api.IMessageFilters;
-public class MessageFilters implements IMessageFilters
+public class MessageFilters implements IMessageFilters, IMatcher
-    private final Set<Filter> filters = new CopyOnWriteArraySet<>();
-    public boolean permit(IInstance from, IInstance to, int verb)
+    private final IMatcher MATCH_ALL = (from, to, msg) -> true;
+    private final List<Filter> filters = new CopyOnWriteArrayList<>();
+    /**
+     * {@code true} value returned by this method implies that the message was not matched
by any
+     * filters and therefore should be delivered.
+     */
+    public boolean matches(int from, int to, IMessage message)
-        if (from == null || to == null)
-            return false; // cannot deliver
-        int fromNum = from.config().num();
-        int toNum = to.config().num();
         for (Filter filter : filters)
-            if (filter.matches(fromNum, toNum, verb))
+        {
+            // here, matching logic is inverted: we _drop_ every message that matcher has
+            if (filter.matches(from, to, message))
 Review comment:
   this causes me to double take while reading; the method name is `matches` which calls `matches`
which acts differently... do feel old name was better

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.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message