public static class ConnectionUtils.LeaderConnectingAddressListener extends Object implements LeaderRetrievalListener
LeaderRetrievalListener
that allows retrieving an InetAddress
for the
current leader.Constructor and Description |
---|
LeaderConnectingAddressListener(RpcSystemUtils rpcSystemUtils) |
Modifier and Type | Method and Description |
---|---|
InetAddress |
findConnectingAddress(Duration timeout) |
InetAddress |
findConnectingAddress(Duration timeout,
Duration startLoggingAfter) |
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. |
public LeaderConnectingAddressListener(RpcSystemUtils rpcSystemUtils)
public InetAddress findConnectingAddress(Duration timeout) throws LeaderRetrievalException
LeaderRetrievalException
public InetAddress findConnectingAddress(Duration timeout, Duration startLoggingAfter) throws LeaderRetrievalException
LeaderRetrievalException
public void notifyLeaderAddress(String leaderAddress, UUID leaderSessionID)
LeaderRetrievalListener
LeaderRetrievalService
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
in interface LeaderRetrievalListener
leaderAddress
- The address of the new leaderleaderSessionID
- The new leader session IDpublic void handleError(Exception exception)
LeaderRetrievalListener
LeaderRetrievalService
in case of an exception. This
assures that the LeaderRetrievalListener
is aware of any problems occurring in the
LeaderRetrievalService
thread.handleError
in interface LeaderRetrievalListener
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.