Repository: incubator-atlas Updated Branches: refs/heads/master e15629c2e -> b73e62ba3
ATLAS-1036 Multiple instances of AtlasPluginClassloader getting initialized (sumasai, mneethiraj) Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/b73e62ba Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/b73e62ba Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/b73e62ba Branch: refs/heads/master Commit: b73e62ba3cb58df422246bfad880657b982f1bc5 Parents: e15629c Author: Suma Shivaprasad <[email protected]> Authored: Wed Jul 20 17:32:15 2016 -0700 Committer: Suma Shivaprasad <[email protected]> Committed: Wed Jul 20 17:32:15 2016 -0700 ---------------------------------------------------------------------- .../classloader/AtlasPluginClassLoader.java | 23 ++++++++++++++------ release-log.txt | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b73e62ba/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java ---------------------------------------------------------------------- diff --git a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java index c5214bd..92cc406 100644 --- a/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java +++ b/plugin-classloader/src/main/java/org/apache/atlas/plugin/classloader/AtlasPluginClassLoader.java @@ -35,6 +35,8 @@ import java.util.Enumeration; public final class AtlasPluginClassLoader extends URLClassLoader { private static final Logger LOG = LoggerFactory.getLogger(AtlasPluginClassLoader.class); + private static volatile AtlasPluginClassLoader me = null; + private final MyClassLoader componentClassLoader; private AtlasPluginClassLoader(String pluginType, Class<?> pluginClass) throws Exception { @@ -54,13 +56,20 @@ public final class AtlasPluginClassLoader extends URLClassLoader { public static AtlasPluginClassLoader getInstance(final String pluginType, final Class<?> pluginClass) throws Exception { - AtlasPluginClassLoader ret = - AccessController.doPrivileged(new PrivilegedExceptionAction<AtlasPluginClassLoader>() { - public AtlasPluginClassLoader run() throws Exception { - return new AtlasPluginClassLoader(pluginType, pluginClass); - } - }); - + AtlasPluginClassLoader ret = me; + if (ret == null) { + synchronized (AtlasPluginClassLoader.class) { + ret = me; + if (ret == null) { + me = AccessController.doPrivileged(new PrivilegedExceptionAction<AtlasPluginClassLoader>() { + public AtlasPluginClassLoader run() throws Exception { + return new AtlasPluginClassLoader(pluginType, pluginClass); + } + }); + ret = me; + } + } + } return ret; } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b73e62ba/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 1b5d899..a2d01ba 100644 --- a/release-log.txt +++ b/release-log.txt @@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ALL CHANGES: +ATLAS-1036 Multiple instances of AtlasPluginClassloader getting initialized (sumasai, mneethiraj) ATLAS-1033 fix for issues flagged by Coverity scan (mneethiraj via sumasai) ATLAS-1036 Compilation error on java 1.8 - GraphBackedDiscoveryService (shwethags via sumasai) ATLAS-1034 Incorrect Falcon hook impl class name in Falcon hook shim (mneethiraj via shwethags)
