Code review comment: ```suggestion                     throw new RpcLoaderException( ```

Code before review:
public RpcSystem loadRpcSystem(Configuration config) {
try {
LOG.debug(
"Using Fallback AkkaRpcSystemLoader; this loader will invoke maven to retrieve the dependencies of flink-rpc-akka.");
final ClassLoader flinkClassLoader = RpcSystem.class.getClassLoader();
final Path akkaRpcModuleDirectory =
findAkkaRpcModuleDirectory(getCurrentWorkingDirectory());
final Path akkaRpcModuleClassesDirectory =
akkaRpcModuleDirectory.resolve(Paths.get("target", "classes"));
final Path akkaRpcModuleDependenciesDirectory =
akkaRpcModuleDirectory.resolve(Paths.get("target", "dependencies"));
if (!Files.exists(akkaRpcModuleDependenciesDirectory)) {
int exitCode =
downloadDependencies(
akkaRpcModuleDirectory, akkaRpcModuleDependenciesDirectory);
if (exitCode != 0) {
throw new RuntimeException(
"Can not download dependencies, please see the output log for reason.");
}
} else {
LOG.debug(
"Re-using previously downloaded flink-rpc-akka dependencies. If you are experiencing strange issues, try clearing '{}'.",
akkaRpcModuleDependenciesDirectory);
}
final List<URL> urls = new ArrayList<>();
urls.add(akkaRpcModuleClassesDirectory.toUri().toURL());
try (final Stream<Path> files = Files.list(akkaRpcModuleDependenciesDirectory)) {
final List<Path> collect =
files.filter(path -> path.getFileName().toString().endsWith(".jar"))
.collect(Collectors.toList());
for (Path path : collect) {
urls.add(path.toUri().toURL());
}
}
final SubmoduleClassLoader submoduleClassLoader =
new SubmoduleClassLoader(urls.toArray(new URL[0]), flinkClassLoader);
return new CleanupOnCloseRpcSystem(
ServiceLoader.load(RpcSystem.class, submoduleClassLoader).iterator().next(),
submoduleClassLoader,
null);
} catch (Exception e) {
throw new RpcLoaderException(
String.format(
"Could not initialize RPC system. Run '%s' on the command-line instead.",
AkkaRpcSystemLoader.HINT_USAGE),
e);
}
}

Line under review: throw new RuntimeException(

Code after addressing the review:
public RpcSystem loadRpcSystem(Configuration config) {
try {
LOG.debug(
"Using Fallback AkkaRpcSystemLoader; this loader will invoke maven to retrieve the dependencies of flink-rpc-akka.");
final ClassLoader flinkClassLoader = RpcSystem.class.getClassLoader();
final Path akkaRpcModuleDirectory =
findAkkaRpcModuleDirectory(getCurrentWorkingDirectory());
final Path akkaRpcModuleClassesDirectory =
akkaRpcModuleDirectory.resolve(Paths.get("target", "classes"));
final Path akkaRpcModuleDependenciesDirectory =
akkaRpcModuleDirectory.resolve(Paths.get("target", "dependencies"));
if (!Files.exists(akkaRpcModuleDependenciesDirectory)) {
int exitCode =
downloadDependencies(
akkaRpcModuleDirectory, akkaRpcModuleDependenciesDirectory);
if (exitCode != 0) {
throw new RpcLoaderException(
"Could not download dependencies of flink-rpc-akka, please see the log output for details.");
}
} else {
LOG.debug(
"Re-using previously downloaded flink-rpc-akka dependencies. If you are experiencing strange issues, try clearing '{}'.",
akkaRpcModuleDependenciesDirectory);
}
final List<URL> urls = new ArrayList<>();
urls.add(akkaRpcModuleClassesDirectory.toUri().toURL());
try (final Stream<Path> files = Files.list(akkaRpcModuleDependenciesDirectory)) {
final List<Path> collect =
files.filter(path -> path.getFileName().toString().endsWith(".jar"))
.collect(Collectors.toList());
for (Path path : collect) {
urls.add(path.toUri().toURL());
}
}
final SubmoduleClassLoader submoduleClassLoader =
new SubmoduleClassLoader(urls.toArray(new URL[0]), flinkClassLoader);
return new CleanupOnCloseRpcSystem(
ServiceLoader.load(RpcSystem.class, submoduleClassLoader).iterator().next(),
submoduleClassLoader,
null);
} catch (Exception e) {
throw new RpcLoaderException(
String.format(
"Could not initialize RPC system. Run '%s' on the command-line instead.",
AkkaRpcSystemLoader.HINT_USAGE),
e);
}
}