use of org.apache.flink.runtime.rpc.messages.UnfencedMessage in project flink by apache.
the class FencedAkkaRpcActor method handleRpcMessage.
@Override
protected void handleRpcMessage(Object message) {
if (message instanceof FencedMessage) {
final F expectedFencingToken = rpcEndpoint.getFencingToken();
if (expectedFencingToken == null) {
if (log.isDebugEnabled()) {
log.debug("Fencing token not set: Ignoring message {} because the fencing token is null.", message);
}
sendErrorIfSender(new FencingTokenException(String.format("Fencing token not set: Ignoring message %s sent to %s because the fencing token is null.", message, rpcEndpoint.getAddress())));
} else {
@SuppressWarnings("unchecked") FencedMessage<F, ?> fencedMessage = ((FencedMessage<F, ?>) message);
F fencingToken = fencedMessage.getFencingToken();
if (Objects.equals(expectedFencingToken, fencingToken)) {
super.handleRpcMessage(fencedMessage.getPayload());
} else {
if (log.isDebugEnabled()) {
log.debug("Fencing token mismatch: Ignoring message {} because the fencing token {} did " + "not match the expected fencing token {}.", message, fencingToken, expectedFencingToken);
}
sendErrorIfSender(new FencingTokenException("Fencing token mismatch: Ignoring message " + message + " because the fencing token " + fencingToken + " did not match the expected fencing token " + expectedFencingToken + '.'));
}
}
} else if (message instanceof UnfencedMessage) {
super.handleRpcMessage(((UnfencedMessage<?>) message).getPayload());
} else {
if (log.isDebugEnabled()) {
log.debug("Unknown message type: Ignoring message {} because it is neither of type {} nor {}.", message, FencedMessage.class.getSimpleName(), UnfencedMessage.class.getSimpleName());
}
sendErrorIfSender(new AkkaUnknownMessageException("Unknown message type: Ignoring message " + message + " of type " + message.getClass().getSimpleName() + " because it is neither of type " + FencedMessage.class.getSimpleName() + " nor " + UnfencedMessage.class.getSimpleName() + '.'));
}
}
Aggregations