[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/68998378
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/68998378
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/68998378

Branch: refs/heads/flip-6
Commit: 689983781c30db903b52d593b2fbfebba1ab6236
Parents: fe90811
Author: Stephan Ewen <se...@apache.org>
Authored: Tue Aug 16 21:11:01 2016 +0200
Committer: Till Rohrmann <trohrm...@apache.org>
Committed: Wed Sep 21 11:39:14 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/68998378/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);
 

Reply via email to