Search in sources :

Example 1 with IMessageSink

use of org.apache.cassandra.net.IMessageSink in project cassandra by apache.

the class AbstractPendingRepairTest method setupClass.

@BeforeClass
public static void setupClass() {
    SchemaLoader.prepareServer();
    ARS = ActiveRepairService.instance;
    LocalSessionAccessor.startup();
    // cutoff messaging service
    MessagingService.instance().addMessageSink(new IMessageSink() {

        public boolean allowOutgoingMessage(MessageOut message, int id, InetAddress to) {
            return false;
        }

        public boolean allowIncomingMessage(MessageIn message, int id) {
            return false;
        }
    });
}
Also used : MessageIn(org.apache.cassandra.net.MessageIn) IMessageSink(org.apache.cassandra.net.IMessageSink) MessageOut(org.apache.cassandra.net.MessageOut) InetAddress(java.net.InetAddress) BeforeClass(org.junit.BeforeClass)

Example 2 with IMessageSink

use of org.apache.cassandra.net.IMessageSink in project cassandra by apache.

the class ValidatorTest method registerOutgoingMessageSink.

private CompletableFuture<MessageOut> registerOutgoingMessageSink() {
    final CompletableFuture<MessageOut> future = new CompletableFuture<>();
    MessagingService.instance().addMessageSink(new IMessageSink() {

        public boolean allowOutgoingMessage(MessageOut message, int id, InetAddress to) {
            future.complete(message);
            return false;
        }

        public boolean allowIncomingMessage(MessageIn message, int id) {
            return false;
        }
    });
    return future;
}
Also used : MessageIn(org.apache.cassandra.net.MessageIn) CompletableFuture(java.util.concurrent.CompletableFuture) IMessageSink(org.apache.cassandra.net.IMessageSink) MessageOut(org.apache.cassandra.net.MessageOut) InetAddress(java.net.InetAddress)

Aggregations

InetAddress (java.net.InetAddress)2 IMessageSink (org.apache.cassandra.net.IMessageSink)2 MessageIn (org.apache.cassandra.net.MessageIn)2 MessageOut (org.apache.cassandra.net.MessageOut)2 CompletableFuture (java.util.concurrent.CompletableFuture)1 BeforeClass (org.junit.BeforeClass)1