Class ResourceManagerServiceImpl
- java.lang.Object
-
- org.apache.flink.runtime.resourcemanager.ResourceManagerServiceImpl
-
- All Implemented Interfaces:
AutoCloseable
,LeaderContender
,ResourceManagerService
,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()
Trigger the closing of the resource and return the corresponding close future.static ResourceManagerServiceImpl
create(ResourceManagerFactory<?> resourceManagerFactory, Configuration configuration, ResourceID resourceId, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, DelegationTokenManager delegationTokenManager, 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.void
grantLeadership(UUID newLeaderSessionID)
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader.void
handleError(Exception exception)
Callback method which is called byLeaderElectionService
in case of an error in the service thread.void
revokeLeadership()
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader.void
start()
Start the service.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.util.AutoCloseableAsync
close
-
-
-
-
Method Detail
-
start
public void start() throws Exception
Description copied from interface:ResourceManagerService
Start the service.- Specified by:
start
in interfaceResourceManagerService
- Throws:
Exception
- if the service cannot be started
-
getTerminationFuture
public CompletableFuture<Void> getTerminationFuture()
Description copied from interface:ResourceManagerService
Return termination future of the service.- Specified by:
getTerminationFuture
in interfaceResourceManagerService
- Returns:
- termination future of the service.
-
deregisterApplication
public CompletableFuture<Void> deregisterApplication(ApplicationStatus applicationStatus, @Nullable String diagnostics)
Description copied from interface:ResourceManagerService
Deregister the Flink application from the resource management system by signalling theResourceManager
.- Specified by:
deregisterApplication
in 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()
Description copied from interface:AutoCloseableAsync
Trigger the closing of the resource and return the corresponding close future.- Specified by:
closeAsync
in interfaceAutoCloseableAsync
- Returns:
- Future which is completed once the resource has been closed
-
grantLeadership
public void grantLeadership(UUID newLeaderSessionID)
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon selecting this instance as the new leader. The method is called with the new leader session ID.- Specified by:
grantLeadership
in interfaceLeaderContender
- Parameters:
newLeaderSessionID
- New leader session ID
-
revokeLeadership
public void revokeLeadership()
Description copied from interface:LeaderContender
Callback method which is called by theLeaderElectionService
upon revoking the leadership of a former leader. This might happen in case that multiple contenders have been granted leadership.- Specified by:
revokeLeadership
in interfaceLeaderContender
-
handleError
public void handleError(Exception exception)
Description copied from interface:LeaderContender
Callback method which is called byLeaderElectionService
in case of an error in the service thread.- Specified by:
handleError
in interfaceLeaderContender
- Parameters:
exception
- Caught exception
-
getLeaderResourceManager
@VisibleForTesting @Nullable public ResourceManager<?> getLeaderResourceManager()
-
create
public static ResourceManagerServiceImpl create(ResourceManagerFactory<?> resourceManagerFactory, Configuration configuration, ResourceID resourceId, RpcService rpcService, HighAvailabilityServices highAvailabilityServices, HeartbeatServices heartbeatServices, DelegationTokenManager delegationTokenManager, FatalErrorHandler fatalErrorHandler, ClusterInformation clusterInformation, @Nullable String webInterfaceUrl, MetricRegistry metricRegistry, String hostname, Executor ioExecutor) throws Exception
- Throws:
Exception
-
-