Class GRpcAgentJobKillServiceImpl
- All Implemented Interfaces:
AgentJobKillService
AgentJobKillService
that listens for kill signals from the server
using event listeners.
This implementation works by sending a unary gRPC request to the server, which holds the response until it has a kill signal to send or until the request times out. It attaches event listeners to the response future, which automatically process the response when it arrives. If a request fails, a periodic task with exponential backoff is used to retry creating a new request. The implementation properly handles request cancellation during shutdown.
Note: this implementation still suffers from a limitation: because it uses unary gRPC calls, the server will never realize the client is gone if the connection is broken. This can lead to an accumulation of parked calls on the server if clients disconnect abnormally. A protocol based on bidirectional streaming would be necessary to fully solve this problem.
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionGRpcAgentJobKillServiceImpl
(com.netflix.genie.proto.JobKillServiceGrpc.JobKillServiceFutureStub client, KillService killService, org.springframework.scheduling.TaskScheduler taskScheduler, JobKillServiceProperties properties) Constructor. -
Method Summary
-
Constructor Details
-
GRpcAgentJobKillServiceImpl
public GRpcAgentJobKillServiceImpl(com.netflix.genie.proto.JobKillServiceGrpc.JobKillServiceFutureStub client, KillService killService, org.springframework.scheduling.TaskScheduler taskScheduler, JobKillServiceProperties properties) Constructor.- Parameters:
client
- The gRPC client to use to call the serverkillService
- KillService for killing the agenttaskScheduler
- A task schedulerproperties
- The service properties
-
-
Method Details
-
start
public void start(@NotBlank(message="Job id cannot be blank") @NotBlank(message="Job id cannot be blank") String requestedJobId) Start listening for job termination notification.- Specified by:
start
in interfaceAgentJobKillService
- Parameters:
requestedJobId
- job id
-
stop
public void stop()Stop the service.- Specified by:
stop
in interfaceAgentJobKillService
-