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 void
addJob(org.apache.flink.api.common.JobID jobId, String defaultTargetAddress)
Add the given job to be monitored.boolean
containsJob(org.apache.flink.api.common.JobID jobId)
Check whether the service monitors the given job.void
reconnect(org.apache.flink.api.common.JobID jobId)
Triggers reconnection to the last known leader of the given job.void
removeJob(org.apache.flink.api.common.JobID jobId)
Remove the given job from being monitored by the job leader service.void
start(String initialOwnerAddress, org.apache.flink.runtime.rpc.RpcService initialRpcService, HighAvailabilityServices initialHighAvailabilityServices, JobLeaderListener initialJobLeaderListener)
Start the job leader service with the given services.void
stop()
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:JobLeaderService
Start the job leader service with the given services.- Specified by:
start
in 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 Exception
Description copied from interface:JobLeaderService
Stop the job leader services. This implies stopping all leader retrieval services for the different jobs and their leader retrieval listeners.- Specified by:
stop
in 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:JobLeaderService
Remove the given job from being monitored by the job leader service.- Specified by:
removeJob
in interfaceJobLeaderService
- Parameters:
jobId
- identifying the job to remove from monitoring
-
addJob
public void addJob(org.apache.flink.api.common.JobID jobId, String defaultTargetAddress) throws Exception
Description copied from interface:JobLeaderService
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.- Specified by:
addJob
in 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:JobLeaderService
Triggers reconnection to the last known leader of the given job.- Specified by:
reconnect
in 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:
containsJob
in interfaceJobLeaderService
- Parameters:
jobId
- identifying the job- Returns:
- True if the given job is monitored; otherwise false
-
-