[FLINK-4834] [cluster management] Add LeaderIdMismatchException at a common way to report RPC calls rejected due to outdated leader status.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/91f1d098 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/91f1d098 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/91f1d098 Branch: refs/heads/master Commit: 91f1d098fea09506910a30d2a51517b015613bf4 Parents: 8734100 Author: Stephan Ewen <[email protected]> Authored: Mon Oct 17 20:20:26 2016 +0200 Committer: Stephan Ewen <[email protected]> Committed: Fri Dec 23 20:54:25 2016 +0100 ---------------------------------------------------------------------- .../LeaderIdMismatchException.java | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/91f1d098/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/LeaderIdMismatchException.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/LeaderIdMismatchException.java b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/LeaderIdMismatchException.java new file mode 100644 index 0000000..5caf1b2 --- /dev/null +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/LeaderIdMismatchException.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.highavailability; + +import java.util.UUID; + +/** + * An exception thrown when the leader session id attached to a message does not match + * the leader session id that the receiver expects. + */ +public class LeaderIdMismatchException extends Exception { + + private static final long serialVersionUID = 1L; + + private final UUID expected; + private final UUID actual; + + public LeaderIdMismatchException(UUID expected, UUID actual) { + super("Leader session ID mismatch: expected=" + expected + ", actual=" + actual); + this.expected = expected; + this.actual = actual; + } + + public UUID getExpected() { + return expected; + } + + public UUID getActual() { + return actual; + } +}
