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
Modifier and TypeMethodDescriptionvoidAdd the given job to be monitored.booleancontainsJob(org.apache.flink.api.common.JobID jobId) Check whether the service monitors the given job.voidreconnect(org.apache.flink.api.common.JobID jobId) Triggers reconnection to the last known leader of the given job.voidremoveJob(org.apache.flink.api.common.JobID jobId) Remove the given job from being monitored by the job leader service.voidstart(String initialOwnerAddress, org.apache.flink.runtime.rpc.RpcService initialRpcService, HighAvailabilityServices initialHighAvailabilityServices, JobLeaderListener initialJobLeaderListener) Start the job leader service with the given services.voidstop()Stop the job leader services.
-
Method Details
-
start
void start(String initialOwnerAddress, org.apache.flink.runtime.rpc.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
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(org.apache.flink.api.common.JobID jobId) Remove the given job from being monitored by the job leader service.- Parameters:
jobId- identifying the job to remove from monitoring
-
addJob
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(org.apache.flink.api.common.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(org.apache.flink.api.common.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
-