Search in sources :

Example 1 with StreamDeserializingTask

use of org.apache.cassandra.streaming.StreamDeserializingTask in project cassandra by apache.

the class StreamingMultiplexedChannel method createChannel.

private StreamingChannel createChannel(StreamingChannel.Kind kind) throws IOException {
    logger.debug("Creating stream session to {} as {}", to, session.isFollower() ? "follower" : "initiator");
    StreamingChannel channel = factory.create(to, messagingVersion, kind);
    if (kind == StreamingChannel.Kind.CONTROL) {
        executorFactory().startThread(String.format("Stream-Deserializer-%s-%s", to.toString(), channel.id()), new StreamDeserializingTask(session, channel, messagingVersion));
        session.attachInbound(channel);
    }
    session.attachOutbound(channel);
    logger.debug("Creating {}", channel.description());
    return channel;
}
Also used : StreamingChannel(org.apache.cassandra.streaming.StreamingChannel) StreamDeserializingTask(org.apache.cassandra.streaming.StreamDeserializingTask)

Example 2 with StreamDeserializingTask

use of org.apache.cassandra.streaming.StreamDeserializingTask in project cassandra by apache.

the class StreamingInboundHandlerTest method StreamDeserializingTask_deriveSession_StreamInitMessage.

@Test
public void StreamDeserializingTask_deriveSession_StreamInitMessage() {
    StreamInitMessage msg = new StreamInitMessage(REMOTE_ADDR, 0, UUID.randomUUID(), StreamOperation.REPAIR, UUID.randomUUID(), PreviewKind.ALL);
    StreamDeserializingTask task = new StreamDeserializingTask(null, streamingChannel, streamingChannel.messagingVersion);
    StreamSession session = task.deriveSession(msg);
    Assert.assertNotNull(session);
}
Also used : StreamSession(org.apache.cassandra.streaming.StreamSession) StreamInitMessage(org.apache.cassandra.streaming.messages.StreamInitMessage) StreamDeserializingTask(org.apache.cassandra.streaming.StreamDeserializingTask) Test(org.junit.Test)

Example 3 with StreamDeserializingTask

use of org.apache.cassandra.streaming.StreamDeserializingTask in project cassandra by apache.

the class StreamingInboundHandlerTest method StreamDeserializingTask_deriveSession_NoSession.

@Test(expected = UnsupportedOperationException.class)
public void StreamDeserializingTask_deriveSession_NoSession() {
    CompleteMessage msg = new CompleteMessage();
    StreamDeserializingTask task = new StreamDeserializingTask(null, streamingChannel, streamingChannel.messagingVersion);
    task.deriveSession(msg);
}
Also used : CompleteMessage(org.apache.cassandra.streaming.messages.CompleteMessage) StreamDeserializingTask(org.apache.cassandra.streaming.StreamDeserializingTask) Test(org.junit.Test)

Aggregations

StreamDeserializingTask (org.apache.cassandra.streaming.StreamDeserializingTask)3 Test (org.junit.Test)2 StreamSession (org.apache.cassandra.streaming.StreamSession)1 StreamingChannel (org.apache.cassandra.streaming.StreamingChannel)1 CompleteMessage (org.apache.cassandra.streaming.messages.CompleteMessage)1 StreamInitMessage (org.apache.cassandra.streaming.messages.StreamInitMessage)1