use of org.apache.cassandra.streaming.messages.KeepAliveMessage in project cassandra by apache.
the class StreamDeserializingTask method run.
@Override
public void run() {
// closed in finally
@SuppressWarnings("resource") StreamingDataInputPlus input = channel.in();
try {
StreamMessage message;
while (null != (message = StreamMessage.deserialize(input, messagingVersion))) {
// wrt session lifecycle, due to races), just log that we received the message and carry on
if (message instanceof KeepAliveMessage) {
if (logger.isDebugEnabled())
logger.debug("{} Received {}", createLogTag(session, channel), message);
continue;
}
if (session == null)
session = deriveSession(message);
if (logger.isDebugEnabled())
logger.debug("{} Received {}", createLogTag(session, channel), message);
session.messageReceived(message);
}
} catch (Throwable t) {
JVMStabilityInspector.inspectThrowable(t);
if (session != null) {
session.onError(t);
} else if (t instanceof StreamReceiveException) {
((StreamReceiveException) t).session.onError(t.getCause());
} else {
logger.error("{} stream operation from {} failed", createLogTag(session, channel), InetAddressAndPort.toString(channel.peer(), true), t);
}
} finally {
channel.close();
input.close();
}
}
Aggregations