You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/07/09 23:46:45 UTC

[32/50] git commit: Aggregate the class loaders of classes involved in the proxy creation.

Aggregate the class loaders of classes involved in the proxy creation.

Should be more generic than the previous approach.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/39f740fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/39f740fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/39f740fe

Branch: refs/heads/master
Commit: 39f740fe748ca3601d7c200a13a5467f4f3a2279
Parents: 6dda7b6
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue Jul 8 10:33:28 2014 +0300
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Jul 9 22:34:45 2014 +0100

----------------------------------------------------------------------
 .../java/brooklyn/entity/proxying/InternalEntityFactory.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/39f740fe/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java b/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
index 931c2d3..d5461ec 100644
--- a/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
+++ b/core/src/main/java/brooklyn/entity/proxying/InternalEntityFactory.java
@@ -147,8 +147,10 @@ public class InternalEntityFactory {
         // Building our own aggregating class loader gets around this.
         // But we really should not have to do this! What are the consequences?
         AggregateClassLoader aggregateClassLoader =  AggregateClassLoader.newInstanceWithNoLoaders();
-        aggregateClassLoader.addFirst(classloader);
-        aggregateClassLoader.addLast(Entity.class.getClassLoader());
+        aggregateClassLoader.addFirst(entity.getClass().getClassLoader());
+        for(Class<?> iface : interfaces) {
+            aggregateClassLoader.addLast(iface.getClassLoader());
+        }
 
         return (T) java.lang.reflect.Proxy.newProxyInstance(
                 aggregateClassLoader,