Java Code Examples for org.apache.flink.util.LambdaUtil#withContextClassLoader()
The following examples show how to use
org.apache.flink.util.LambdaUtil#withContextClassLoader() .
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: MasterHooks.java From flink with Apache License 2.0 | 5 votes |
@Nullable @Override public CompletableFuture<T> triggerCheckpoint(long checkpointId, long timestamp, final Executor executor) throws Exception { final Executor wrappedExecutor = command -> executor.execute(new WrappedCommand(userClassLoader, command)); return LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.triggerCheckpoint(checkpointId, timestamp, wrappedExecutor)); }
Example 2
Source File: MasterHooks.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Nullable @Override public CompletableFuture<T> triggerCheckpoint(long checkpointId, long timestamp, final Executor executor) throws Exception { final Executor wrappedExecutor = new Executor() { @Override public void execute(Runnable command) { executor.execute(new WrappedCommand(userClassLoader, command)); } }; return LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.triggerCheckpoint(checkpointId, timestamp, wrappedExecutor)); }
Example 3
Source File: SavepointOutputFormat.java From flink with Apache License 2.0 | 5 votes |
@Override public void writeRecord(CheckpointMetadata metadata) throws IOException { String path = LambdaUtil.withContextClassLoader(getRuntimeContext().getUserCodeClassLoader(), () -> { try (CheckpointMetadataOutputStream out = targetLocation.createMetadataOutputStream()) { Checkpoints.storeCheckpointMetadata(metadata, out); CompletedCheckpointStorageLocation finalizedLocation = out.closeAndFinalizeCheckpoint(); return finalizedLocation.getExternalPointer(); } }); LOG.info("Savepoint written to " + path); }
Example 4
Source File: SavepointOutputFormat.java From flink with Apache License 2.0 | 5 votes |
@Override public void writeRecord(Savepoint savepoint) throws IOException { String path = LambdaUtil.withContextClassLoader(getRuntimeContext().getUserCodeClassLoader(), () -> { try (CheckpointMetadataOutputStream out = targetLocation.createMetadataOutputStream()) { Checkpoints.storeCheckpointMetadata(savepoint, out); CompletedCheckpointStorageLocation finalizedLocation = out.closeAndFinalizeCheckpoint(); return finalizedLocation.getExternalPointer(); } }); LOG.info("Savepoint written to " + path); }
Example 5
Source File: MasterHooks.java From flink with Apache License 2.0 | 5 votes |
@Nullable @Override public CompletableFuture<T> triggerCheckpoint(long checkpointId, long timestamp, final Executor executor) throws Exception { final Executor wrappedExecutor = new Executor() { @Override public void execute(Runnable command) { executor.execute(new WrappedCommand(userClassLoader, command)); } }; return LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.triggerCheckpoint(checkpointId, timestamp, wrappedExecutor)); }
Example 6
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public String getIdentifier() { return LambdaUtil.withContextClassLoader(userClassLoader, hook::getIdentifier); }
Example 7
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Nullable @Override public SimpleVersionedSerializer<T> createCheckpointDataSerializer() { return LambdaUtil.withContextClassLoader(userClassLoader, hook::createCheckpointDataSerializer); }
Example 8
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void close() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::close); }
Example 9
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void reset() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::reset); }
Example 10
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void run() { LambdaUtil.withContextClassLoader(userClassLoader, command::run); }
Example 11
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Nullable @Override public SimpleVersionedSerializer<T> createCheckpointDataSerializer() { return LambdaUtil.withContextClassLoader(userClassLoader, hook::createCheckpointDataSerializer); }
Example 12
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void restoreCheckpoint(long checkpointId, @Nullable T checkpointData) throws Exception { LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.restoreCheckpoint(checkpointId, checkpointData)); }
Example 13
Source File: MasterHooks.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void reset() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::reset); }
Example 14
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void close() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::close); }
Example 15
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void reset() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::reset); }
Example 16
Source File: MasterHooks.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void run() { LambdaUtil.withContextClassLoader(userClassLoader, command::run); }
Example 17
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void restoreCheckpoint(long checkpointId, @Nullable T checkpointData) throws Exception { LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.restoreCheckpoint(checkpointId, checkpointData)); }
Example 18
Source File: MasterHooks.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void restoreCheckpoint(long checkpointId, @Nullable T checkpointData) throws Exception { LambdaUtil.withContextClassLoader( userClassLoader, () -> hook.restoreCheckpoint(checkpointId, checkpointData)); }
Example 19
Source File: MasterHooks.java From flink with Apache License 2.0 | 4 votes |
@Override public void run() { LambdaUtil.withContextClassLoader(userClassLoader, command::run); }
Example 20
Source File: MasterHooks.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override public void close() throws Exception { LambdaUtil.withContextClassLoader(userClassLoader, hook::close); }