You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/02/24 11:32:42 UTC
[03/10] flink git commit: [hotfix] Don't fail LeaderContender and
Listener when closing EmbeddedLeaderService
[hotfix] Don't fail LeaderContender and Listener when closing EmbeddedLeaderService
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/6868cacd
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/6868cacd
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/6868cacd
Branch: refs/heads/master
Commit: 6868cacdf309404a553831409734c2f65f16587c
Parents: 1897e23
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Feb 15 18:14:55 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Feb 23 18:22:07 2018 +0100
----------------------------------------------------------------------
.../nonha/embedded/EmbeddedLeaderService.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/6868cacd/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
index 5eb4375..ce964a3 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java
@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
+
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@@ -38,7 +39,7 @@ import static org.apache.flink.util.Preconditions.checkState;
/**
* A simple leader election service, which selects a leader among contenders and notifies listeners.
- *
+ *
* <p>An election service for contenders can be created via {@link #createLeaderElectionService()},
* a listener service for leader observers can be created via {@link #createLeaderRetrievalService()}.
*/
@@ -54,19 +55,19 @@ public class EmbeddedLeaderService {
private final Set<EmbeddedLeaderRetrievalService> listeners;
- /** proposed leader, which has been notified of leadership grant, but has not confirmed */
+ /** proposed leader, which has been notified of leadership grant, but has not confirmed. */
private EmbeddedLeaderElectionService currentLeaderProposed;
- /** actual leader that has confirmed leadership and of which listeners have been notified */
+ /** actual leader that has confirmed leadership and of which listeners have been notified. */
private EmbeddedLeaderElectionService currentLeaderConfirmed;
- /** fencing UID for the current leader (or proposed leader) */
+ /** fencing UID for the current leader (or proposed leader). */
private UUID currentLeaderSessionId;
- /** the cached address of the current leader */
+ /** the cached address of the current leader. */
private String currentLeaderAddress;
- /** flag marking the service as terminated */
+ /** flag marking the service as terminated. */
private boolean shutdown;
// ------------------------------------------------------------------------
@@ -83,7 +84,7 @@ public class EmbeddedLeaderService {
/**
* Shuts down this leader election service.
- *
+ *
* <p>This method does not perform a clean revocation of the leader status and
* no notification to any leader listeners. It simply notifies all contenders
* and listeners that the service is no longer available.
@@ -364,7 +365,7 @@ public class EmbeddedLeaderService {
if (running) {
running = false;
isLeader = false;
- contender.handleError(cause);
+ contender.revokeLeadership();
contender = null;
}
}
@@ -392,7 +393,6 @@ public class EmbeddedLeaderService {
public void shutdown(Exception cause) {
if (running) {
running = false;
- listener.handleError(cause);
listener = null;
}
}