public class RpcServerStandbyGrpcService extends RpcServerService
RpcServerService.Factory
.
Manages the behavior of the master's rpc service. The grpc server is always on.
When the promotion/demotion happens, the rpc service will be stopped and restarted.
The new started grpc service will serve gRPC endpoints based on the node state (PRIMARY/STANDBY).
No rejecting server is deployed.RpcServerService.Factory
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG |
mBindAddress, mGrpcServer, mMasterProcess, mMasterRegistry, mRejectingGrpcServer, mRpcExecutor
Modifier | Constructor and Description |
---|---|
protected |
RpcServerStandbyGrpcService(InetSocketAddress bindAddress,
MasterProcess masterProcess,
MasterRegistry masterRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
demote()
Demotes the service back to
NodeState.STANDBY state. |
boolean |
isServingLeader() |
boolean |
isServingStandby() |
void |
promote()
Promotes the service to
NodeState.PRIMARY state. |
void |
start()
Starts the service.
|
void |
stop()
Stops the service altogether and cleans up any state left.
|
isGrpcServerServing, isServing, startGrpcServer, startRejectingServer, stopGrpcServer, stopRejectingServer, stopRpcExecutor, waitFor, waitForBound, waitForFree
protected RpcServerStandbyGrpcService(InetSocketAddress bindAddress, MasterProcess masterProcess, MasterRegistry masterRegistry)
public boolean isServingLeader()
isServingLeader
in class RpcServerService
public boolean isServingStandby()
isServingStandby
in class RpcServerService
public void start()
SimpleService
NodeState.STANDBY
state.
Leaves the service in the same state as SimpleService.demote()
.
Can only be called once.start
in interface SimpleService
start
in class RpcServerService
public void stop()
SimpleService
SimpleService.start()
has not been called on this service this method should be a noop.
Can only be called once.stop
in interface SimpleService
stop
in class RpcServerService
public void promote()
SimpleService
NodeState.PRIMARY
state.
Can only be called on a started service (i.e. SimpleService.start()
must precede this method).
Can only be called in NodeState.STANDBY
state.
Can be called multiple times (e.g. a service is promoted, then demoted, then promoted again).promote
in interface SimpleService
promote
in class RpcServerService
public void demote()
SimpleService
NodeState.STANDBY
state.
Can only be called on a started service (i.e. SimpleService.start()
must precede this method).
Can only be called in NodeState.PRIMARY
state (i.e. SimpleService.promote()
must precede this method).
Can be called multiple times (e.g. a service is promoted, then demoted, then promoted again,
and demoted again).demote
in interface SimpleService
demote
in class RpcServerService
Copyright © 2023. All Rights Reserved.