cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] ifesdjeen commented on a change in pull request #428: CASSANDRA-15505
Date Thu, 30 Jan 2020 10:46:38 GMT
ifesdjeen commented on a change in pull request #428: CASSANDRA-15505 
URL: https://github.com/apache/cassandra/pull/428#discussion_r372877925
 
 

 ##########
 File path: test/distributed/org/apache/cassandra/distributed/impl/MessageFilters.java
 ##########
 @@ -19,28 +19,23 @@
 package org.apache.cassandra.distributed.impl;
 
 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.IMessage;
 import org.apache.cassandra.distributed.api.IMessageFilters;
-import org.apache.cassandra.net.Verb;
 
 public class MessageFilters implements IMessageFilters
 {
-    private final Set<Filter> filters = new CopyOnWriteArraySet<>();
+    private final List<Filter> filters = new CopyOnWriteArrayList<>();
 
-    public boolean permit(IInstance from, IInstance to, int verb)
+    public boolean permit(int from, int to, IMessage msg)
     {
-        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))
-                return false;
-
+        {
+            if (filter.matches(from, to, msg))
+                return filter.permitIfMatched;
 
 Review comment:
   We also can achieve the same thing by simply returning `false` and not matching on custom
matcher.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message