Package alluxio
Class AbstractMasterClient
- java.lang.Object
-
- alluxio.AbstractClient
-
- alluxio.AbstractMasterClient
-
- All Implemented Interfaces:
Client
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
AbstractJobMasterClient
@ThreadSafe public abstract class AbstractMasterClient extends AbstractClient
The base class for master clients.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class alluxio.AbstractClient
AbstractClient.RpcCallable<V>
-
-
Field Summary
-
Fields inherited from class alluxio.AbstractClient
mAlwaysEnableTLS, mChannel, mClosed, mConnected, mContext, mServerAddress, mServiceVersion, mVersionService
-
-
Constructor Summary
Constructors Constructor Description AbstractMasterClient(MasterClientContext clientConf)
Creates a new master client base and default the selection policy to primary master.AbstractMasterClient(MasterClientContext clientConf, MasterSelectionPolicy selectionPolicy)
Creates a new master client base.AbstractMasterClient(MasterClientContext clientConf, MasterSelectionPolicy selectionPolicy, java.util.function.Supplier<RetryPolicy> retryPolicySupplier)
Creates a new master client without a specific address.AbstractMasterClient(MasterClientContext clientConf, java.util.function.Supplier<RetryPolicy> retryPolicySupplier)
Creates a new master client without a specific address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterDisconnect()
This method is called after the connection is disconnected.protected void
beforeConnect()
This method is called before the connection is connected.java.net.InetSocketAddress
getConfAddress()
By default, return the same underlying address asAbstractClient.getRemoteSockAddress()
.protected GrpcServerAddress
queryGrpcServerAddress()
AbstractClient
works with Grpc Servers.-
Methods inherited from class alluxio.AbstractClient
afterConnect, beforeDisconnect, checkVersion, close, connect, connectWithRuntimeException, disconnect, getRemoteHostName, getRemoteServiceType, getRemoteServiceVersion, getRemoteSockAddress, getServiceName, getServiceVersion, isClosed, isConnected, retryRPC, retryRPC
-
-
-
-
Constructor Detail
-
AbstractMasterClient
public AbstractMasterClient(MasterClientContext clientConf)
Creates a new master client base and default the selection policy to primary master.- Parameters:
clientConf
- master client configuration
-
AbstractMasterClient
public AbstractMasterClient(MasterClientContext clientConf, MasterSelectionPolicy selectionPolicy)
Creates a new master client base.- Parameters:
clientConf
- master client configurationselectionPolicy
- master selection policy: which master the client should connect to
-
AbstractMasterClient
public AbstractMasterClient(MasterClientContext clientConf, java.util.function.Supplier<RetryPolicy> retryPolicySupplier)
Creates a new master client without a specific address. The client defaults to connect to the primary master.- Parameters:
clientConf
- master client configurationretryPolicySupplier
- retry policy to use
-
AbstractMasterClient
public AbstractMasterClient(MasterClientContext clientConf, MasterSelectionPolicy selectionPolicy, java.util.function.Supplier<RetryPolicy> retryPolicySupplier)
Creates a new master client without a specific address.- Parameters:
clientConf
- master client configurationselectionPolicy
- master selection policy: which master the client should connect toretryPolicySupplier
- retry policy to use
-
-
Method Detail
-
getConfAddress
public java.net.InetSocketAddress getConfAddress() throws UnavailableException
Description copied from class:AbstractClient
By default, return the same underlying address asAbstractClient.getRemoteSockAddress()
. Child classes should override this implementation if they intend to have different address to fetch configuration.- Specified by:
getConfAddress
in interfaceClient
- Overrides:
getConfAddress
in classAbstractClient
- Returns:
- the remote address of the configuration server
- Throws:
UnavailableException
- if address cannot be determined
-
beforeConnect
protected void beforeConnect() throws java.io.IOException
Description copied from class:AbstractClient
This method is called before the connection is connected. Implementations should add any additional operations before the connection is connected. loading the cluster defaults- Overrides:
beforeConnect
in classAbstractClient
- Throws:
java.io.IOException
-
afterDisconnect
protected void afterDisconnect()
Description copied from class:AbstractClient
This method is called after the connection is disconnected. Implementations should clean up any additional state created for the connection.- Overrides:
afterDisconnect
in classAbstractClient
-
queryGrpcServerAddress
protected GrpcServerAddress queryGrpcServerAddress() throws UnavailableException
Description copied from class:AbstractClient
AbstractClient
works with Grpc Servers. Child classes should only override this method to query the address of the grpc server they talk to. The conversion fromGrpcServerAddress
to more genericSocketAddress
required byClient.getRemoteSockAddress()
is handled by this class.- Specified by:
queryGrpcServerAddress
in classAbstractClient
- Returns:
- the
GrpcServerAddress
of the remote server - Throws:
UnavailableException
- if address can't be determined
-
-