Repository: flink Updated Branches: refs/heads/flip-6 5df27ebd7 -> b7259d617
[FLINK-4403] [rpc] Use relative classloader for proxies, rather than system class loader. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/b7259d61 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/b7259d61 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/b7259d61 Branch: refs/heads/flip-6 Commit: b7259d617bbb080e486ae91aaf3d9b24addb352c Parents: 68addf3 Author: Stephan Ewen <se...@apache.org> Authored: Tue Aug 16 21:11:01 2016 +0200 Committer: Stephan Ewen <se...@apache.org> Committed: Tue Aug 16 21:38:35 2016 +0200 ---------------------------------------------------------------------- .../org/apache/flink/runtime/rpc/akka/AkkaRpcService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/b7259d61/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java index b647bbd..d987c2f 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcService.java @@ -104,9 +104,14 @@ public class AkkaRpcService implements RpcService { InvocationHandler akkaInvocationHandler = new AkkaInvocationHandler(actorRef, timeout, maximumFramesize); + // Rather than using the System ClassLoader directly, we derive the ClassLoader + // from this class . That works better in cases where Flink runs embedded and all Flink + // code is loaded dynamically (for example from an OSGI bundle) through a custom ClassLoader + ClassLoader classLoader = AkkaRpcService.this.getClass().getClassLoader(); + @SuppressWarnings("unchecked") C proxy = (C) Proxy.newProxyInstance( - ClassLoader.getSystemClassLoader(), + classLoader, new Class<?>[] {clazz}, akkaInvocationHandler);