public class StateBackendLoader extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FS_STATE_BACKEND_NAME
The shortcut configuration name for the FileSystem State backend
|
static String |
MEMORY_STATE_BACKEND_NAME
The shortcut configuration name for the MemoryState backend that checkpoints to the
JobManager
|
static String |
ROCKSDB_STATE_BACKEND_NAME
The shortcut configuration name for the RocksDB State Backend
|
Modifier and Type | Method and Description |
---|---|
static StateBackend |
fromApplicationOrConfigOrDefault(StateBackend fromApplication,
Configuration config,
ClassLoader classLoader,
org.slf4j.Logger logger)
Checks if an application-defined state backend is given, and if not, loads the state backend
from the configuration, from the parameter 'state.backend', as defined in
CheckpointingOptions.STATE_BACKEND . |
static StateBackend |
loadStateBackendFromConfig(ReadableConfig config,
ClassLoader classLoader,
org.slf4j.Logger logger)
Loads the state backend from the configuration, from the parameter 'state.backend', as
defined in
CheckpointingOptions.STATE_BACKEND . |
static boolean |
stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory(Configuration config,
Optional<Boolean> stateBackendFromApplicationUsesManagedMemory,
ClassLoader classLoader)
Checks whether state backend uses managed memory, without having to deserialize or load the
state backend.
|
public static final String MEMORY_STATE_BACKEND_NAME
public static final String FS_STATE_BACKEND_NAME
public static final String ROCKSDB_STATE_BACKEND_NAME
public static StateBackend loadStateBackendFromConfig(ReadableConfig config, ClassLoader classLoader, @Nullable org.slf4j.Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException
CheckpointingOptions.STATE_BACKEND
.
The state backends can be specified either via their shortcut name, or via the class name
of a StateBackendFactory
. If a StateBackendFactory class name is specified, the
factory is instantiated (via its zero-argument constructor) and its StateBackendFactory.createFromConfig(ReadableConfig, ClassLoader)
method is called.
Recognized shortcut names are '', '', and ''.
config
- The configuration to load the state backend fromclassLoader
- The class loader that should be used to load the state backendlogger
- Optionally, a logger to log actions to (may be null)DynamicCodeLoadingException
- Thrown if a state backend factory is configured and the
factory class was not found or the factory could not be instantiatedIllegalConfigurationException
- May be thrown by the StateBackendFactory when creating
/ configuring the state backend in the factoryIOException
- May be thrown by the StateBackendFactory when instantiating the state
backendpublic static StateBackend fromApplicationOrConfigOrDefault(@Nullable StateBackend fromApplication, Configuration config, ClassLoader classLoader, @Nullable org.slf4j.Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException
CheckpointingOptions.STATE_BACKEND
. If no state backend is configured, this instantiates the
default state backend (the MemoryStateBackend
).
If an application-defined state backend is found, and the state backend is a ConfigurableStateBackend
, this methods calls ConfigurableStateBackend.configure(ReadableConfig, ClassLoader)
on the state backend.
Refer to loadStateBackendFromConfig(ReadableConfig, ClassLoader, Logger)
for
details on how the state backend is loaded from the configuration.
config
- The configuration to load the state backend fromclassLoader
- The class loader that should be used to load the state backendlogger
- Optionally, a logger to log actions to (may be null)DynamicCodeLoadingException
- Thrown if a state backend factory is configured and the
factory class was not found or the factory could not be instantiatedIllegalConfigurationException
- May be thrown by the StateBackendFactory when creating
/ configuring the state backend in the factoryIOException
- May be thrown by the StateBackendFactory when instantiating the state
backendpublic static boolean stateBackendFromApplicationOrConfigOrDefaultUseManagedMemory(Configuration config, Optional<Boolean> stateBackendFromApplicationUsesManagedMemory, ClassLoader classLoader)
config
- Cluster configuration.stateBackendFromApplicationUsesManagedMemory
- Whether the application-defined backend
uses Flink's managed memory. Empty if application has not defined a backend.classLoader
- User code classloader.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.