Commit b73e62ba by Suma Shivaprasad

ATLAS-1036 Multiple instances of AtlasPluginClassloader getting initialized (sumasai, mneethiraj)

parent e15629c2
...@@ -35,6 +35,8 @@ import java.util.Enumeration; ...@@ -35,6 +35,8 @@ import java.util.Enumeration;
public final class AtlasPluginClassLoader extends URLClassLoader { public final class AtlasPluginClassLoader extends URLClassLoader {
private static final Logger LOG = LoggerFactory.getLogger(AtlasPluginClassLoader.class); private static final Logger LOG = LoggerFactory.getLogger(AtlasPluginClassLoader.class);
private static volatile AtlasPluginClassLoader me = null;
private final MyClassLoader componentClassLoader; private final MyClassLoader componentClassLoader;
private AtlasPluginClassLoader(String pluginType, Class<?> pluginClass) throws Exception { private AtlasPluginClassLoader(String pluginType, Class<?> pluginClass) throws Exception {
...@@ -54,13 +56,20 @@ public final class AtlasPluginClassLoader extends URLClassLoader { ...@@ -54,13 +56,20 @@ public final class AtlasPluginClassLoader extends URLClassLoader {
public static AtlasPluginClassLoader getInstance(final String pluginType, final Class<?> pluginClass) public static AtlasPluginClassLoader getInstance(final String pluginType, final Class<?> pluginClass)
throws Exception { throws Exception {
AtlasPluginClassLoader ret = AtlasPluginClassLoader ret = me;
AccessController.doPrivileged(new PrivilegedExceptionAction<AtlasPluginClassLoader>() { if (ret == null) {
public AtlasPluginClassLoader run() throws Exception { synchronized (AtlasPluginClassLoader.class) {
return new AtlasPluginClassLoader(pluginType, pluginClass); 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; return ret;
} }
......
...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES: ...@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL 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-1033 fix for issues flagged by Coverity scan (mneethiraj via sumasai)
ATLAS-1036 Compilation error on java 1.8 - GraphBackedDiscoveryService (shwethags 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) ATLAS-1034 Incorrect Falcon hook impl class name in Falcon hook shim (mneethiraj via shwethags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment