public abstract class MasterProcess extends Object implements Process
MasterProcess
should implement.
This class serves as a common implementation for functions that both the AlluxioMasterProcess and
AlluxioJobMasterProcess use. Each master should have an RPC server, web server, and journaling
system which can serve client requests.Modifier and Type | Field and Description |
---|---|
protected GrpcServer |
mGrpcServer
The RPC server.
|
protected Lock |
mGrpcServerLock |
protected JournalSystem |
mJournalSystem
The journal system for writing journal entries and restoring master state.
|
protected PrimarySelector |
mLeaderSelector |
protected Thread |
mServingThread |
protected long |
mServingThreadTimeoutMs |
protected WebServer |
mWebServer
The web ui server.
|
protected Lock |
mWebServerLock |
Constructor and Description |
---|
MasterProcess(JournalSystem journalSystem,
PrimarySelector leaderSelector,
NetworkAddressUtils.ServiceType webService,
NetworkAddressUtils.ServiceType rpcService)
Prepares a
MasterProcess journal, rpc and web server using the given sockets. |
Modifier and Type | Method and Description |
---|---|
abstract <T extends Master> |
getMaster(Class<T> clazz)
Gets the registered class from the master registry.
|
abstract InetSocketAddress |
getRpcAddress() |
long |
getStartTimeMs() |
long |
getUptimeMs() |
abstract InetSocketAddress |
getWebAddress() |
boolean |
isGrpcServing() |
boolean |
isMetricSinkServing() |
boolean |
isWebServing() |
protected void |
startRejectingServers() |
protected void |
startServing() |
protected void |
stopRejectingRpcServer() |
protected void |
stopRejectingServers() |
protected void |
stopRejectingWebServer() |
boolean |
waitForGrpcServerReady(int timeoutMs)
Waits until the grpc server is ready to serve requests.
|
boolean |
waitForMetricSinkServing(int timeoutMs)
Wait until the metrics sinks have been started.
|
boolean |
waitForReady(int timeoutMs)
Waits until the process is ready to serve requests.
|
boolean |
waitForWebServerReady(int timeoutMs)
Waits until the web server is ready to serve requests.
|
protected final JournalSystem mJournalSystem
protected final PrimarySelector mLeaderSelector
@Nullable protected GrpcServer mGrpcServer
protected final Lock mGrpcServerLock
protected final Lock mWebServerLock
protected final long mServingThreadTimeoutMs
protected Thread mServingThread
public MasterProcess(JournalSystem journalSystem, PrimarySelector leaderSelector, NetworkAddressUtils.ServiceType webService, NetworkAddressUtils.ServiceType rpcService)
MasterProcess
journal, rpc and web server using the given sockets.journalSystem
- the journaling systemleaderSelector
- the leader selectorwebService
- the web service typerpcService
- the rpc service typepublic abstract InetSocketAddress getRpcAddress()
public abstract <T extends Master> T getMaster(Class<T> clazz)
T
- the type of the master to getclazz
- the class of the master to getpublic long getStartTimeMs()
protected void startServing()
public long getUptimeMs()
public abstract InetSocketAddress getWebAddress()
public boolean isGrpcServing()
public boolean isWebServing()
public boolean isMetricSinkServing()
public boolean waitForGrpcServerReady(int timeoutMs)
timeoutMs
- how long to wait in millisecondspublic boolean waitForWebServerReady(int timeoutMs)
timeoutMs
- how long to wait in millisecondspublic boolean waitForMetricSinkServing(int timeoutMs)
timeoutMs
- how long to wait in millisecondspublic boolean waitForReady(int timeoutMs)
Process
waitForReady
in interface Process
timeoutMs
- how long to wait in millisecondsprotected void startRejectingServers()
protected void stopRejectingRpcServer()
protected void stopRejectingWebServer()
protected void stopRejectingServers()
Copyright © 2023. All Rights Reserved.