public class LeaderRetriever extends Object implements LeaderRetrievalListener
| 限定符和类型 | 字段和说明 |
|---|---|
protected org.slf4j.Logger |
log |
| 构造器和说明 |
|---|
LeaderRetriever() |
| 限定符和类型 | 方法和说明 |
|---|---|
CompletableFuture<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> |
getLeaderFuture()
Returns the current JobManagerGateway future.
|
Optional<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> |
getLeaderNow()
Returns the current leader information if available.
|
void |
handleError(Exception exception)
This method is called by the
LeaderRetrievalService in case of an exception. |
void |
notifyLeaderAddress(String leaderAddress,
UUID leaderSessionID)
This method is called by the
LeaderRetrievalService when a new leader is elected. |
protected void |
notifyNewLeaderAddress(CompletableFuture<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> newLeaderAddressFuture) |
public Optional<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> getLeaderNow() throws Exception
Exception - if the leader future has been completed with an exceptionpublic CompletableFuture<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> getLeaderFuture()
public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID)
LeaderRetrievalListenerLeaderRetrievalService when a new leader is elected.
If both arguments are null then it signals that leadership was revoked without a new leader having been elected.
notifyLeaderAddress 在接口中 LeaderRetrievalListenerleaderAddress - The address of the new leaderleaderSessionID - The new leader session IDpublic void handleError(Exception exception)
LeaderRetrievalListenerLeaderRetrievalService in case of an exception. This
assures that the LeaderRetrievalListener is aware of any problems occurring in the
LeaderRetrievalService thread.handleError 在接口中 LeaderRetrievalListenerprotected void notifyNewLeaderAddress(CompletableFuture<org.apache.flink.api.java.tuple.Tuple2<String,UUID>> newLeaderAddressFuture)
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.