Search in sources :

Example 1 with AkkaUnknownMessageException

use of org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException 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() + '.'));
    }
}
Also used : AkkaUnknownMessageException(org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException) LocalFencedMessage(org.apache.flink.runtime.rpc.messages.LocalFencedMessage) FencedMessage(org.apache.flink.runtime.rpc.messages.FencedMessage) FencingTokenException(org.apache.flink.runtime.rpc.exceptions.FencingTokenException) UnfencedMessage(org.apache.flink.runtime.rpc.messages.UnfencedMessage)

Example 2 with AkkaUnknownMessageException

use of org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException in project flink by apache.

the class AkkaRpcActor method handleRpcMessage.

protected void handleRpcMessage(Object message) {
    if (message instanceof RunAsync) {
        handleRunAsync((RunAsync) message);
    } else if (message instanceof CallAsync) {
        handleCallAsync((CallAsync) message);
    } else if (message instanceof RpcInvocation) {
        handleRpcInvocation((RpcInvocation) message);
    } else {
        log.warn("Received message of unknown type {} with value {}. Dropping this message!", message.getClass().getName(), message);
        sendErrorIfSender(new AkkaUnknownMessageException("Received unknown message " + message + " of type " + message.getClass().getSimpleName() + '.'));
    }
}
Also used : LocalRpcInvocation(org.apache.flink.runtime.rpc.messages.LocalRpcInvocation) RpcInvocation(org.apache.flink.runtime.rpc.messages.RpcInvocation) AkkaUnknownMessageException(org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException) RunAsync(org.apache.flink.runtime.rpc.messages.RunAsync) CallAsync(org.apache.flink.runtime.rpc.messages.CallAsync)

Example 3 with AkkaUnknownMessageException

use of org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException in project flink by apache.

the class AkkaRpcActor method handleUnknownControlMessage.

private void handleUnknownControlMessage(ControlMessages controlMessage) {
    final String message = String.format("Received unknown control message %s. Dropping this message!", controlMessage);
    log.warn(message);
    sendErrorIfSender(new AkkaUnknownMessageException(message));
}
Also used : AkkaUnknownMessageException(org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException)

Example 4 with AkkaUnknownMessageException

use of org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException in project flink by apache.

the class SupervisorActor method handleUnknownMessage.

private void handleUnknownMessage(Object msg) {
    final AkkaUnknownMessageException cause = new AkkaUnknownMessageException(String.format("Cannot handle unknown message %s.", msg));
    getSender().tell(new akka.actor.Status.Failure(cause), getSelf());
    throw cause;
}
Also used : AkkaUnknownMessageException(org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException)

Aggregations

AkkaUnknownMessageException (org.apache.flink.runtime.rpc.akka.exceptions.AkkaUnknownMessageException)4 FencingTokenException (org.apache.flink.runtime.rpc.exceptions.FencingTokenException)1 CallAsync (org.apache.flink.runtime.rpc.messages.CallAsync)1 FencedMessage (org.apache.flink.runtime.rpc.messages.FencedMessage)1 LocalFencedMessage (org.apache.flink.runtime.rpc.messages.LocalFencedMessage)1 LocalRpcInvocation (org.apache.flink.runtime.rpc.messages.LocalRpcInvocation)1 RpcInvocation (org.apache.flink.runtime.rpc.messages.RpcInvocation)1 RunAsync (org.apache.flink.runtime.rpc.messages.RunAsync)1 UnfencedMessage (org.apache.flink.runtime.rpc.messages.UnfencedMessage)1