zentol commented on a change in pull request #16345:
URL: https://github.com/apache/flink/pull/16345#discussion_r666205404
##########
File path:
flink-rpc/flink-rpc-core/src/main/java/org/apache/flink/runtime/rpc/RpcSystem.java
##########
@@ -86,8 +95,28 @@ static RpcSystem load() {
* @return loaded RpcSystem
*/
static RpcSystem load(Configuration config) {
- final ClassLoader classLoader = RpcSystem.class.getClassLoader();
- return ServiceLoader.load(RpcSystem.class,
classLoader).iterator().next();
+ try {
+ final ClassLoader classLoader = RpcSystem.class.getClassLoader();
+
+ final String tmpDirectory =
ConfigurationUtils.parseTempDirectories(config)[0];
+ final Path tempFile = Files.createFile(Paths.get(tmpDirectory,
"flink-rpc-akka.jar"));
+ IOUtils.copyBytes(
+ classLoader.getResourceAsStream("flink-rpc-akka.jar"),
+ Files.newOutputStream(tempFile));
+
+ final PluginLoader pluginLoader =
+ PluginLoader.create(
+ new PluginDescriptor(
+ "flink-rpc-akka",
+ new URL[] {tempFile.toUri().toURL()},
+ new String[0]),
+ classLoader,
+
CoreOptions.getPluginParentFirstLoaderPatterns(config));
+ return new PluginLoaderClosingRpcSystem(
+ pluginLoader.load(RpcSystem.class).next(), pluginLoader);
Review comment:
This is now implemented in a separate `flink-rpc-akka-loader` module.
I made it a separate module to ensure the bits that do the actual loading
never directly reference flink-rpc-akka classes. This means a consumer can
either use flink-rpc-akka directly like any other dependency (e.g., during
tests), or buy into a separate classloading consuming flink-rpc-akka-loader
instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]