Class DefaultJobLeaderService
- java.lang.Object
-
- org.apache.flink.runtime.taskexecutor.DefaultJobLeaderService
-
- All Implemented Interfaces:
JobLeaderService
public class DefaultJobLeaderService extends Object implements JobLeaderService
Default implementation ofJobLeaderService.
-
-
Constructor Summary
Constructors Constructor Description DefaultJobLeaderService(UnresolvedTaskManagerLocation location, RetryingRegistrationConfiguration retryingRegistrationConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJob(org.apache.flink.api.common.JobID jobId, String defaultTargetAddress)Add 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.
-
-
-
Constructor Detail
-
DefaultJobLeaderService
public DefaultJobLeaderService(UnresolvedTaskManagerLocation location, RetryingRegistrationConfiguration retryingRegistrationConfiguration)
-
-
Method Detail
-
start
public void start(String initialOwnerAddress, org.apache.flink.runtime.rpc.RpcService initialRpcService, HighAvailabilityServices initialHighAvailabilityServices, JobLeaderListener initialJobLeaderListener)
Description copied from interface:JobLeaderServiceStart the job leader service with the given services.- Specified by:
startin interfaceJobLeaderService- 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
public void stop() throws ExceptionDescription copied from interface:JobLeaderServiceStop the job leader services. This implies stopping all leader retrieval services for the different jobs and their leader retrieval listeners.- Specified by:
stopin interfaceJobLeaderService- Throws:
Exception- if an error occurs while stopping the service
-
removeJob
public void removeJob(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobLeaderServiceRemove the given job from being monitored by the job leader service.- Specified by:
removeJobin interfaceJobLeaderService- Parameters:
jobId- identifying the job to remove from monitoring
-
addJob
public void addJob(org.apache.flink.api.common.JobID jobId, String defaultTargetAddress) throws ExceptionDescription copied from interface:JobLeaderServiceAdd 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.- Specified by:
addJobin interfaceJobLeaderService- Parameters:
jobId- identifying the job to monitordefaultTargetAddress- of the job leader- Throws:
Exception- if an error occurs while starting the leader retrieval service
-
reconnect
public void reconnect(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobLeaderServiceTriggers reconnection to the last known leader of the given job.- Specified by:
reconnectin interfaceJobLeaderService- Parameters:
jobId- specifying the job for which to trigger reconnection
-
containsJob
@VisibleForTesting public boolean containsJob(org.apache.flink.api.common.JobID jobId)
Check whether the service monitors the given job.- Specified by:
containsJobin interfaceJobLeaderService- Parameters:
jobId- identifying the job- Returns:
- True if the given job is monitored; otherwise false
-
-