Class ResourceManagerServiceImpl
- java.lang.Object
-
- org.apache.flink.runtime.resourcemanager.ResourceManagerServiceImpl
-
- All Implemented Interfaces:
AutoCloseable,LeaderContender,ResourceManagerService,org.apache.flink.util.AutoCloseableAsync
public class ResourceManagerServiceImpl extends Object implements ResourceManagerService, LeaderContender
Default implementation ofResourceManagerService.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>closeAsync()static ResourceManagerServiceImplcreate(ResourceManagerFactory<?> resourceManagerFactory, org.apache.flink.configuration.Configuration configuration, ResourceID resourceId, org.apache.flink.runtime.rpc.RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, DelegationTokenManager delegationTokenManager, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler, ClusterInformation clusterInformation, String webInterfaceUrl, MetricRegistry metricRegistry, String hostname, Executor ioExecutor)CompletableFuture<Void>deregisterApplication(ApplicationStatus applicationStatus, String diagnostics)Deregister the Flink application from the resource management system by signalling theResourceManager.ResourceManager<?>getLeaderResourceManager()CompletableFuture<Void>getTerminationFuture()Return termination future of the service.voidgrantLeadership(UUID newLeaderSessionID)Callback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader.voidhandleError(Exception exception)Callback method which is called byLeaderElectionServicein case of an error in the service thread.voidrevokeLeadership()Callback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader.voidstart()Start the service.
-
-
-
Method Detail
-
start
public void start() throws ExceptionDescription copied from interface:ResourceManagerServiceStart the service.- Specified by:
startin interfaceResourceManagerService- Throws:
Exception- if the service cannot be started
-
getTerminationFuture
public CompletableFuture<Void> getTerminationFuture()
Description copied from interface:ResourceManagerServiceReturn termination future of the service.- Specified by:
getTerminationFuturein interfaceResourceManagerService- Returns:
- termination future of the service.
-
deregisterApplication
public CompletableFuture<Void> deregisterApplication(ApplicationStatus applicationStatus, @Nullable String diagnostics)
Description copied from interface:ResourceManagerServiceDeregister the Flink application from the resource management system by signalling theResourceManager.- Specified by:
deregisterApplicationin interfaceResourceManagerService- Parameters:
applicationStatus- to terminate the application withdiagnostics- additional information about the shut down, can benull- Returns:
- Future which is completed once the shut down
-
closeAsync
public CompletableFuture<Void> closeAsync()
- Specified by:
closeAsyncin interfaceorg.apache.flink.util.AutoCloseableAsync
-
grantLeadership
public void grantLeadership(UUID newLeaderSessionID)
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadershipin interfaceLeaderContender- Parameters:
newLeaderSessionID- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContenderCallback method which is called by theLeaderElectionServiceupon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadershipin interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContenderCallback method which is called byLeaderElectionServicein case of an error in the service thread.- Specified by:
handleErrorin interfaceLeaderContender- Parameters:
exception- Caught exception
-
getLeaderResourceManager
@VisibleForTesting @Nullable public ResourceManager<?> getLeaderResourceManager()
-
create
public static ResourceManagerServiceImpl create(ResourceManagerFactory<?> resourceManagerFactory, org.apache.flink.configuration.Configuration configuration, ResourceID resourceId, org.apache.flink.runtime.rpc.RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, DelegationTokenManager delegationTokenManager, org.apache.flink.runtime.rpc.FatalErrorHandler fatalErrorHandler, ClusterInformation clusterInformation, @Nullable String webInterfaceUrl, MetricRegistry metricRegistry, String hostname, Executor ioExecutor) throws Exception
- Throws:
Exception
-
-