org.apache.flink.util.DynamicCodeLoadingException Java Examples
The following examples show how to use
org.apache.flink.util.DynamicCodeLoadingException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StreamExecutionEnvironment.java From flink with Apache License 2.0 | 5 votes |
private StateBackend loadStateBackend(ReadableConfig configuration, ClassLoader classLoader) { try { return StateBackendLoader.loadStateBackendFromConfig( configuration, classLoader, null); } catch (DynamicCodeLoadingException | IOException e) { throw new WrappingRuntimeException(e); } }
Example #2
Source File: PojoSerializerUpgradeTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public PojoSerializerUpgradeTest(String backendType) throws IOException, DynamicCodeLoadingException { Configuration config = new Configuration(); config.setString(CheckpointingOptions.STATE_BACKEND, backendType); config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, temporaryFolder.newFolder().toURI().toString()); stateBackend = StateBackendLoader.loadStateBackendFromConfig(config, Thread.currentThread().getContextClassLoader(), null); }
Example #3
Source File: StateBackendLoader.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * 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 {@link CheckpointingOptions#STATE_BACKEND}. If no state backend is configured, this instantiates the * default state backend (the {@link MemoryStateBackend}). * * <p>If an application-defined state backend is found, and the state backend is a * {@link ConfigurableStateBackend}, this methods calls {@link ConfigurableStateBackend#configure(Configuration, ClassLoader)} * on the state backend. * * <p>Refer to {@link #loadStateBackendFromConfig(Configuration, ClassLoader, Logger)} for details on * how the state backend is loaded from the configuration. * * @param config The configuration to load the state backend from * @param classLoader The class loader that should be used to load the state backend * @param logger Optionally, a logger to log actions to (may be null) * * @return The instantiated state backend. * * @throws DynamicCodeLoadingException * Thrown if a state backend factory is configured and the factory class was not * found or the factory could not be instantiated * @throws IllegalConfigurationException * May be thrown by the StateBackendFactory when creating / configuring the state * backend in the factory * @throws IOException * May be thrown by the StateBackendFactory when instantiating the state backend */ public static StateBackend fromApplicationOrConfigOrDefault( @Nullable StateBackend fromApplication, Configuration config, ClassLoader classLoader, @Nullable Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException { checkNotNull(config, "config"); checkNotNull(classLoader, "classLoader"); final StateBackend backend; // (1) the application defined state backend has precedence if (fromApplication != null) { if (logger != null) { logger.info("Using application-defined state backend: {}", fromApplication); } // see if this is supposed to pick up additional configuration parameters if (fromApplication instanceof ConfigurableStateBackend) { // needs to pick up configuration if (logger != null) { logger.info("Configuring application-defined state backend with job/cluster config"); } backend = ((ConfigurableStateBackend) fromApplication).configure(config, classLoader); } else { // keep as is! backend = fromApplication; } } else { // (2) check if the config defines a state backend final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, logger); if (fromConfig != null) { backend = fromConfig; } else { // (3) use the default backend = new MemoryStateBackendFactory().createFromConfig(config, classLoader); if (logger != null) { logger.info("No state backend has been configured, using default (Memory / JobManager) {}", backend); } } } return backend; }
Example #4
Source File: PojoSerializerUpgradeTest.java From flink with Apache License 2.0 | 4 votes |
public PojoSerializerUpgradeTest(String backendType) throws IOException, DynamicCodeLoadingException { Configuration config = new Configuration(); config.setString(CheckpointingOptions.STATE_BACKEND, backendType); config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, temporaryFolder.newFolder().toURI().toString()); stateBackend = StateBackendLoader.loadStateBackendFromConfig(config, Thread.currentThread().getContextClassLoader(), null); }
Example #5
Source File: StateBackendLoader.java From flink with Apache License 2.0 | 4 votes |
/** * 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 {@link CheckpointingOptions#STATE_BACKEND}. If no state backend is configured, this instantiates the * default state backend (the {@link MemoryStateBackend}). * * <p>If an application-defined state backend is found, and the state backend is a * {@link ConfigurableStateBackend}, this methods calls {@link ConfigurableStateBackend#configure(Configuration, ClassLoader)} * on the state backend. * * <p>Refer to {@link #loadStateBackendFromConfig(Configuration, ClassLoader, Logger)} for details on * how the state backend is loaded from the configuration. * * @param config The configuration to load the state backend from * @param classLoader The class loader that should be used to load the state backend * @param logger Optionally, a logger to log actions to (may be null) * * @return The instantiated state backend. * * @throws DynamicCodeLoadingException * Thrown if a state backend factory is configured and the factory class was not * found or the factory could not be instantiated * @throws IllegalConfigurationException * May be thrown by the StateBackendFactory when creating / configuring the state * backend in the factory * @throws IOException * May be thrown by the StateBackendFactory when instantiating the state backend */ public static StateBackend fromApplicationOrConfigOrDefault( @Nullable StateBackend fromApplication, Configuration config, ClassLoader classLoader, @Nullable Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException { checkNotNull(config, "config"); checkNotNull(classLoader, "classLoader"); final StateBackend backend; // (1) the application defined state backend has precedence if (fromApplication != null) { if (logger != null) { logger.info("Using application-defined state backend: {}", fromApplication); } // see if this is supposed to pick up additional configuration parameters if (fromApplication instanceof ConfigurableStateBackend) { // needs to pick up configuration if (logger != null) { logger.info("Configuring application-defined state backend with job/cluster config"); } backend = ((ConfigurableStateBackend) fromApplication).configure(config, classLoader); } else { // keep as is! backend = fromApplication; } } else { // (2) check if the config defines a state backend final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, logger); if (fromConfig != null) { backend = fromConfig; } else { // (3) use the default backend = new MemoryStateBackendFactory().createFromConfig(config, classLoader); if (logger != null) { logger.info("No state backend has been configured, using default (Memory / JobManager) {}", backend); } } } return backend; }
Example #6
Source File: PojoSerializerUpgradeTest.java From flink with Apache License 2.0 | 4 votes |
public PojoSerializerUpgradeTest(String backendType) throws IOException, DynamicCodeLoadingException { Configuration config = new Configuration(); config.setString(CheckpointingOptions.STATE_BACKEND, backendType); config.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, temporaryFolder.newFolder().toURI().toString()); stateBackend = StateBackendLoader.loadStateBackendFromConfig(config, Thread.currentThread().getContextClassLoader(), null); }
Example #7
Source File: StateBackendLoader.java From flink with Apache License 2.0 | 4 votes |
/** * 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 {@link CheckpointingOptions#STATE_BACKEND}. If no state backend is configured, this instantiates the * default state backend (the {@link MemoryStateBackend}). * * <p>If an application-defined state backend is found, and the state backend is a * {@link ConfigurableStateBackend}, this methods calls {@link ConfigurableStateBackend#configure(ReadableConfig, ClassLoader)} * on the state backend. * * <p>Refer to {@link #loadStateBackendFromConfig(ReadableConfig, ClassLoader, Logger)} for details on * how the state backend is loaded from the configuration. * * @param config The configuration to load the state backend from * @param classLoader The class loader that should be used to load the state backend * @param logger Optionally, a logger to log actions to (may be null) * * @return The instantiated state backend. * * @throws DynamicCodeLoadingException * Thrown if a state backend factory is configured and the factory class was not * found or the factory could not be instantiated * @throws IllegalConfigurationException * May be thrown by the StateBackendFactory when creating / configuring the state * backend in the factory * @throws IOException * May be thrown by the StateBackendFactory when instantiating the state backend */ public static StateBackend fromApplicationOrConfigOrDefault( @Nullable StateBackend fromApplication, Configuration config, ClassLoader classLoader, @Nullable Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException { checkNotNull(config, "config"); checkNotNull(classLoader, "classLoader"); final StateBackend backend; // (1) the application defined state backend has precedence if (fromApplication != null) { // see if this is supposed to pick up additional configuration parameters if (fromApplication instanceof ConfigurableStateBackend) { // needs to pick up configuration if (logger != null) { logger.info("Using job/cluster config to configure application-defined state backend: {}", fromApplication); } backend = ((ConfigurableStateBackend) fromApplication).configure(config, classLoader); } else { // keep as is! backend = fromApplication; } if (logger != null) { logger.info("Using application-defined state backend: {}", backend); } } else { // (2) check if the config defines a state backend final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, logger); if (fromConfig != null) { backend = fromConfig; } else { // (3) use the default backend = new MemoryStateBackendFactory().createFromConfig(config, classLoader); if (logger != null) { logger.info("No state backend has been configured, using default (Memory / JobManager) {}", backend); } } } return backend; }