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 JournalSystem |
mJournalSystem
The journal system for writing journal entries and restoring master state.
|
protected PrimarySelector |
mLeaderSelector |
protected MasterRegistry |
mRegistry
The master registry.
|
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 GrpcServerBuilder |
createBaseRpcServer() |
Optional<AlluxioExecutorService> |
createRpcExecutorService()
This method is decoupled from
createBaseRpcServer() because the
AlluxioExecutorService needs to be managed (i.e. |
abstract WebServer |
createWebServer() |
<T extends Master> |
getMaster(Class<T> clazz) |
PrimarySelector |
getPrimarySelector() |
MasterRegistry |
getRegistry()
Use only to instantiate
SimpleService s. |
InetSocketAddress |
getRpcAddress() |
InetSocketAddress |
getRpcBindAddress() |
Optional<SafeModeManager> |
getSafeModeManager() |
long |
getStartTimeMs() |
long |
getUptimeMs() |
InetSocketAddress |
getWebAddress() |
InetSocketAddress |
getWebBindAddress() |
boolean |
isGrpcServing() |
boolean |
isMetricSinkServing() |
boolean |
isWebServing() |
void |
registerService(SimpleService service)
Used in master factory after instantiating the master process and before starting the master
process.
|
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
protected final MasterRegistry mRegistry
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 void registerService(SimpleService service)
service
- a service to register for the functioning of the master processpublic abstract GrpcServerBuilder createBaseRpcServer()
createRpcExecutorService()
) and the rpc services (provided by mRegistry
public Optional<AlluxioExecutorService> createRpcExecutorService()
createBaseRpcServer()
because the
AlluxioExecutorService
needs to be managed (i.e. started and stopped) independently
of the rpc server that uses itpublic Optional<SafeModeManager> getSafeModeManager()
SafeModeManager
if you have onepublic final InetSocketAddress getRpcBindAddress()
public final InetSocketAddress getRpcAddress()
public final <T extends Master> T getMaster(Class<T> clazz)
T
- parameterized class of the desired masterclazz
- the class of the master to retrievepublic final MasterRegistry getRegistry()
SimpleService
s.public long getStartTimeMs()
public long getUptimeMs()
public abstract WebServer createWebServer()
public final InetSocketAddress getWebBindAddress()
public final 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 millisecondspublic PrimarySelector getPrimarySelector()
Copyright © 2023. All Rights Reserved.