Class ClusterEntrypoint
- java.lang.Object
-
- org.apache.flink.runtime.entrypoint.ClusterEntrypoint
-
- All Implemented Interfaces:
AutoCloseable
,FatalErrorHandler
,AutoCloseableAsync
- Direct Known Subclasses:
ApplicationClusterEntryPoint
,SessionClusterEntrypoint
public abstract class ClusterEntrypoint extends Object implements AutoCloseableAsync, FatalErrorHandler
Base class for the Flink cluster entry points.Specialization of this class can be used for the session mode and the per-job mode
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClusterEntrypoint.ExecutionMode
Execution mode of the dispatcher.protected static class
ClusterEntrypoint.ShutdownBehaviour
Shutdown behaviour of aClusterEntrypoint
.
-
Field Summary
Fields Modifier and Type Field Description static ConfigOption<String>
INTERNAL_CLUSTER_EXECUTION_MODE
protected static org.slf4j.Logger
LOG
protected static int
RUNTIME_FAILURE_RETURN_CODE
protected static int
STARTUP_FAILURE_RETURN_CODE
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClusterEntrypoint(Configuration configuration)
-
Method Summary
-
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
-
-
-
-
Field Detail
-
INTERNAL_CLUSTER_EXECUTION_MODE
@Internal public static final ConfigOption<String> INTERNAL_CLUSTER_EXECUTION_MODE
-
LOG
protected static final org.slf4j.Logger LOG
-
STARTUP_FAILURE_RETURN_CODE
protected static final int STARTUP_FAILURE_RETURN_CODE
- See Also:
- Constant Field Values
-
RUNTIME_FAILURE_RETURN_CODE
protected static final int RUNTIME_FAILURE_RETURN_CODE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClusterEntrypoint
protected ClusterEntrypoint(Configuration configuration)
-
-
Method Detail
-
getRestPort
public int getRestPort()
-
getRpcPort
public int getRpcPort()
-
getTerminationFuture
public CompletableFuture<ApplicationStatus> getTerminationFuture()
-
startCluster
public void startCluster() throws ClusterEntrypointException
- Throws:
ClusterEntrypointException
-
supportsReactiveMode
protected boolean supportsReactiveMode()
-
installSecurityContext
public static SecurityContext installSecurityContext(Configuration configuration) throws Exception
- Throws:
Exception
-
initializeServices
protected void initializeServices(Configuration configuration, PluginManager pluginManager) throws Exception
- Throws:
Exception
-
getRPCPortRange
protected String getRPCPortRange(Configuration configuration)
Returns the port range for the commonRpcService
.- Parameters:
configuration
- to extract the port range from- Returns:
- Port range for the common
RpcService
-
createHaServices
protected HighAvailabilityServices createHaServices(Configuration configuration, Executor executor, RpcSystemUtils rpcSystemUtils) throws Exception
- Throws:
Exception
-
createHeartbeatServices
protected HeartbeatServices createHeartbeatServices(Configuration configuration)
-
createMetricRegistry
protected MetricRegistryImpl createMetricRegistry(Configuration configuration, PluginManager pluginManager, RpcSystemUtils rpcSystemUtils)
-
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
-
stopClusterServices
protected CompletableFuture<Void> stopClusterServices(boolean cleanupHaData)
-
onFatalError
public void onFatalError(Throwable exception)
Description copied from interface:FatalErrorHandler
Being called when a fatal error occurs.IMPORTANT: This call should never be blocking since it might be called from within the main thread of an
RpcEndpoint
.- Specified by:
onFatalError
in interfaceFatalErrorHandler
- Parameters:
exception
- cause
-
cleanupDirectories
protected void cleanupDirectories(ClusterEntrypoint.ShutdownBehaviour shutdownBehaviour) throws IOException
Clean up of temporary directories created by theClusterEntrypoint
.- Parameters:
shutdownBehaviour
- specifying the shutdown behaviour- Throws:
IOException
- if the temporary directories could not be cleaned up
-
createDispatcherResourceManagerComponentFactory
protected abstract DispatcherResourceManagerComponentFactory createDispatcherResourceManagerComponentFactory(Configuration configuration) throws IOException
- Throws:
IOException
-
createSerializableExecutionGraphStore
protected abstract ExecutionGraphInfoStore createSerializableExecutionGraphStore(Configuration configuration, ScheduledExecutor scheduledExecutor) throws IOException
- Throws:
IOException
-
parseArguments
public static EntrypointClusterConfiguration parseArguments(String[] args) throws FlinkParseException
- Throws:
FlinkParseException
-
loadConfiguration
protected static Configuration loadConfiguration(EntrypointClusterConfiguration entrypointClusterConfiguration)
-
runClusterEntrypoint
public static void runClusterEntrypoint(ClusterEntrypoint clusterEntrypoint)
-
-