public class LeaderRetrievalUtils extends Object
LeaderRetrievalService
class.Modifier and Type | Class and Description |
---|---|
static class |
LeaderRetrievalUtils.LeaderConnectionInfoListener
Helper class which is used by the retrieveLeaderConnectionInfo method to retrieve the
leader's akka URL and the current leader session ID.
|
static class |
LeaderRetrievalUtils.LeaderGatewayListener
Helper class which is used by the retrieveLeaderGateway method as the
LeaderRetrievalListener . |
Modifier and Type | Method and Description |
---|---|
static LeaderRetrievalService |
createLeaderRetrievalService(Configuration configuration)
Creates a
LeaderRetrievalService based on the provided Configuration object. |
static LeaderRetrievalService |
createLeaderRetrievalService(Configuration configuration,
akka.actor.ActorRef standaloneRef)
Creates a
LeaderRetrievalService that either uses the distributed leader election
configured in the configuration, or, in standalone mode, the given actor reference. |
static InetAddress |
findConnectingAddress(LeaderRetrievalService leaderRetrievalService,
scala.concurrent.duration.FiniteDuration timeout) |
static RecoveryMode |
getRecoveryMode(Configuration config)
Gets the recovery mode as configured, based on the
ConfigConstants.RECOVERY_MODE
config key. |
static LeaderConnectionInfo |
retrieveLeaderConnectionInfo(LeaderRetrievalService leaderRetrievalService,
scala.concurrent.duration.FiniteDuration timeout)
Retrieves the leader akka url and the current leader session ID.
|
static ActorGateway |
retrieveLeaderGateway(LeaderRetrievalService leaderRetrievalService,
akka.actor.ActorSystem actorSystem,
scala.concurrent.duration.FiniteDuration timeout)
Retrieves the current leader gateway using the given
LeaderRetrievalService . |
public static LeaderRetrievalService createLeaderRetrievalService(Configuration configuration) throws Exception
LeaderRetrievalService
based on the provided Configuration
object.configuration
- Configuration containing the settings for the LeaderRetrievalService
LeaderRetrievalService
specified in the configuration objectException
public static LeaderRetrievalService createLeaderRetrievalService(Configuration configuration, akka.actor.ActorRef standaloneRef) throws Exception
LeaderRetrievalService
that either uses the distributed leader election
configured in the configuration, or, in standalone mode, the given actor reference.configuration
- Configuration containing the settings for the LeaderRetrievalService
standaloneRef
- Actor reference to be used in standalone mode.LeaderRetrievalService
specified in the configuration objectException
public static ActorGateway retrieveLeaderGateway(LeaderRetrievalService leaderRetrievalService, akka.actor.ActorSystem actorSystem, scala.concurrent.duration.FiniteDuration timeout) throws LeaderRetrievalException
LeaderRetrievalService
. If the
current leader could not be retrieved after the given timeout, then a
LeaderRetrievalException
is thrown.leaderRetrievalService
- LeaderRetrievalService
which is used for the leader retrievalactorSystem
- ActorSystem which is used for the LeaderRetrievalListener
implementationtimeout
- Timeout value for the retrieval callLeaderRetrievalException
- If the actor gateway could not be retrieved or the timeout has been exceededpublic static LeaderConnectionInfo retrieveLeaderConnectionInfo(LeaderRetrievalService leaderRetrievalService, scala.concurrent.duration.FiniteDuration timeout) throws LeaderRetrievalException
LeaderConnectionInfo
instance.leaderRetrievalService
- Leader retrieval service to retrieve the leader connection
informationtimeout
- Timeout when to give up looking for the leaderLeaderRetrievalException
public static InetAddress findConnectingAddress(LeaderRetrievalService leaderRetrievalService, scala.concurrent.duration.FiniteDuration timeout) throws LeaderRetrievalException
LeaderRetrievalException
public static RecoveryMode getRecoveryMode(Configuration config)
ConfigConstants.RECOVERY_MODE
config key.config
- The configuration to read the recovery mode from.IllegalConfigurationException
- Thrown, if the recovery mode does not correspond
to a known value.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.