Package alluxio.master
Class ZkMasterInquireClient
- java.lang.Object
-
- alluxio.master.ZkMasterInquireClient
-
- All Implemented Interfaces:
MasterInquireClient
,java.io.Closeable
,java.lang.AutoCloseable
@ThreadSafe public final class ZkMasterInquireClient extends java.lang.Object implements MasterInquireClient, java.io.Closeable
Utility to get leader from zookeeper.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZkMasterInquireClient.ZkMasterConnectDetails
Details used to connect to the leader Alluxio master via Zookeeper.-
Nested classes/interfaces inherited from interface alluxio.master.MasterInquireClient
MasterInquireClient.ConnectDetails, MasterInquireClient.Factory
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
static ZkMasterInquireClient
getClient(java.lang.String zookeeperAddress, java.lang.String electionPath, java.lang.String leaderPath, int inquireRetryCount, boolean authEnabled)
Gets the client.MasterInquireClient.ConnectDetails
getConnectDetails()
Returns canonical connect details representing how this client connects to the master.java.util.List<java.net.InetSocketAddress>
getMasterRpcAddresses()
java.net.InetSocketAddress
getPrimaryRpcAddress()
-
-
-
Method Detail
-
getClient
public static ZkMasterInquireClient getClient(java.lang.String zookeeperAddress, java.lang.String electionPath, java.lang.String leaderPath, int inquireRetryCount, boolean authEnabled)
Gets the client.- Parameters:
zookeeperAddress
- the address for ZookeeperelectionPath
- the path of the master electionleaderPath
- the path of the leaderinquireRetryCount
- the number of times to retry connectionsauthEnabled
- if Alluxio client-side auth is enabled- Returns:
- the client
-
getPrimaryRpcAddress
public java.net.InetSocketAddress getPrimaryRpcAddress() throws UnavailableException
- Specified by:
getPrimaryRpcAddress
in interfaceMasterInquireClient
- Returns:
- the rpc address of the primary master. The implementation should perform retries if appropriate
- Throws:
UnavailableException
- if the primary rpc address cannot be determined
-
getMasterRpcAddresses
public java.util.List<java.net.InetSocketAddress> getMasterRpcAddresses() throws UnavailableException
- Specified by:
getMasterRpcAddresses
in interfaceMasterInquireClient
- Returns:
- a list of all masters' RPC addresses
- Throws:
UnavailableException
- if the master rpc addresses cannot be determined
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
getConnectDetails
public MasterInquireClient.ConnectDetails getConnectDetails()
Description copied from interface:MasterInquireClient
Returns canonical connect details representing how this client connects to the master.- Specified by:
getConnectDetails
in interfaceMasterInquireClient
- Returns:
- the connect details
-
-