Interface JobLeaderService
-
- All Known Implementing Classes:
DefaultJobLeaderService
public interface JobLeaderService
This service has the responsibility to monitor the job leaders (the job manager which is leader for a given job) for all registered jobs. Upon gaining leadership for a job and detection by the job leader service, the service tries to establish a connection to the job leader. After successfully establishing a connection, the job leader listener is notified about the new job leader and its connection. In case that a job leader loses leadership, the job leader listener is notified as well.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addJob(JobID jobId, String defaultTargetAddress)
Add the given job to be monitored.boolean
containsJob(JobID jobId)
Check whether the service monitors the given job.void
reconnect(JobID jobId)
Triggers reconnection to the last known leader of the given job.void
removeJob(JobID jobId)
Remove the given job from being monitored by the job leader service.void
start(String initialOwnerAddress, RpcService initialRpcService, HighAvailabilityServices initialHighAvailabilityServices, JobLeaderListener initialJobLeaderListener)
Start the job leader service with the given services.void
stop()
Stop the job leader services.
-
-
-
Method Detail
-
start
void start(String initialOwnerAddress, RpcService initialRpcService, HighAvailabilityServices initialHighAvailabilityServices, JobLeaderListener initialJobLeaderListener)
Start the job leader service with the given services.- Parameters:
initialOwnerAddress
- to be used for establishing connections (source address)initialRpcService
- to be used to create rpc connectionsinitialHighAvailabilityServices
- to create leader retrieval services for the different jobsinitialJobLeaderListener
- listening for job leader changes
-
stop
void stop() throws Exception
Stop the job leader services. This implies stopping all leader retrieval services for the different jobs and their leader retrieval listeners.- Throws:
Exception
- if an error occurs while stopping the service
-
removeJob
void removeJob(JobID jobId)
Remove the given job from being monitored by the job leader service.- Parameters:
jobId
- identifying the job to remove from monitoring
-
addJob
void addJob(JobID jobId, String defaultTargetAddress) throws Exception
Add the given job to be monitored. This means that the service tries to detect leaders for this job and then tries to establish a connection to it.- Parameters:
jobId
- identifying the job to monitordefaultTargetAddress
- of the job leader- Throws:
Exception
- if an error occurs while starting the leader retrieval service
-
reconnect
void reconnect(JobID jobId)
Triggers reconnection to the last known leader of the given job.- Parameters:
jobId
- specifying the job for which to trigger reconnection
-
containsJob
boolean containsJob(JobID jobId)
Check whether the service monitors the given job.- Parameters:
jobId
- identifying the job- Returns:
- True if the given job is monitored; otherwise false
-
-