dcapwell commented on code in PR #4288: URL: https://github.com/apache/cassandra/pull/4288#discussion_r2248842754
########## test/simulator/main/org/apache/cassandra/simulator/systems/SimulatedQuery.java: ########## @@ -18,37 +18,50 @@ package org.apache.cassandra.simulator.systems; +import java.util.function.Predicate; + import org.apache.cassandra.distributed.api.ConsistencyLevel; import org.apache.cassandra.distributed.api.IInvokableInstance; import org.apache.cassandra.distributed.api.SimpleQueryResult; import org.apache.cassandra.distributed.impl.Query; public class SimulatedQuery extends SimulatedActionCallable<SimpleQueryResult> { + private static final Predicate<Throwable> DEFAULT_PREDICATE = i -> true; + + private final Predicate<Throwable> onFailure; + public SimulatedQuery(Object description, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Object... params) { - this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, params); + this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, DEFAULT_PREDICATE, params); + } + + public SimulatedQuery(Object description, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Predicate<Throwable> onFailure, Object... params) + { + this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, onFailure, params); } - public SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Object[] params) + private SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Predicate<Throwable> onFailure, Object[] params) Review Comment: lowered visibility as it wasn't used outside of this class ########## test/simulator/main/org/apache/cassandra/simulator/systems/SimulatedQuery.java: ########## @@ -18,37 +18,50 @@ package org.apache.cassandra.simulator.systems; +import java.util.function.Predicate; + import org.apache.cassandra.distributed.api.ConsistencyLevel; import org.apache.cassandra.distributed.api.IInvokableInstance; import org.apache.cassandra.distributed.api.SimpleQueryResult; import org.apache.cassandra.distributed.impl.Query; public class SimulatedQuery extends SimulatedActionCallable<SimpleQueryResult> { + private static final Predicate<Throwable> DEFAULT_PREDICATE = i -> true; + + private final Predicate<Throwable> onFailure; + public SimulatedQuery(Object description, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Object... params) { - this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, params); + this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, DEFAULT_PREDICATE, params); + } + + public SimulatedQuery(Object description, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Predicate<Throwable> onFailure, Object... params) + { + this(description, Modifiers.NONE, Modifiers.NONE, simulated, instance, query, commitConsistency, serialConsistency, onFailure, params); } - public SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Object[] params) + private SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Predicate<Throwable> onFailure, Object[] params) { super(description, self, transitive, simulated, instance, new Query(query, -1, commitConsistency, serialConsistency, params)); + this.onFailure = onFailure; } public SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, long timestamp, ConsistencyLevel consistency, Object... params) { - this(description, self, transitive, simulated, instance, query, timestamp, consistency, null, params); + this(description, self, transitive, simulated, instance, query, timestamp, consistency, null, DEFAULT_PREDICATE, params); } - public SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, long timestamp, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Object[] params) + private SimulatedQuery(Object description, Modifiers self, Modifiers transitive, SimulatedSystems simulated, IInvokableInstance instance, String query, long timestamp, ConsistencyLevel commitConsistency, ConsistencyLevel serialConsistency, Predicate<Throwable> onFailure, Object[] params) Review Comment: lowered visibility as it wasn't used outside of this class -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org