Returns the variable for the context classloader.
328839
@SuppressWarnings("unchecked")
  public E getLevel()
  {
    Thread thread = Thread.currentThread();
    ClassLoader loader = thread.getContextClassLoader();

    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;

        return (E) envLoader.getAttribute(_varName);
      }
    }

    return _globalValue;
  }
355786
def classloader(self):
        
        return self.jvm.org.apache.spark.util.Utils.getContextOrSparkClassLoader()
391929
public static Object getLocalVar(ExecutionContext context, String name) {
        LexicalEnvironment localEnv = context.getLexicalEnvironment();
        if (localEnv.getRecord().hasBinding(context, name)) {
            return localEnv.getRecord().getBindingValue(context, name, false);
        }
        return null;
    }
1066460
private static URLClassLoader getCurrentClassLoader() {
		synchronized (Boot.class) {
			if (dynamicClassLoader == null) {
				final ClassLoader cl = ClassLoader.getSystemClassLoader();
				if (cl instanceof URLClassLoader) {
					dynamicClassLoader = (URLClassLoader) cl;
				} else {
					dynamicClassLoader = URLClassLoader.newInstance(new URL[0], cl);
				}
			}
			return dynamicClassLoader;
		}
	}
1078989
static void setContextClassLoader(final ClassLoader classLoader)
   {
      SecurityManager sm = System.getSecurityManager();
      if (sm == null)
      {
         Thread.currentThread().setContextClassLoader(classLoader);
      }
      else
      {
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run()
            {
               Thread.currentThread().setContextClassLoader(classLoader);
               return null;
            }
         });
      }
   }
563288
public static ClassLoader getContextClassLoader() {
        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
            @Override
            public ClassLoader run() {
                ClassLoader cl = null;
                try {
                    cl = Thread.currentThread().getContextClassLoader();
                } catch (final SecurityException ex) {
                    // fall through
                }
                return cl;
            }
        });
    }
720609
public static ApplicationContext get() {
        ClassLoader classLoader = getContextClassLoader();
        while (classLoader != null) {
            ApplicationContext applicationContext = contextMap.get(classLoader);
            if (applicationContext != null) {
                return applicationContext;
            }
            classLoader = classLoader.getParent();
        }
        return null;
    }
160284
public static ClassLoader getDefault() {
        ClassLoader loader = null;
        try {
            loader = Thread.currentThread().getContextClassLoader();
        } catch (Exception ignored) {
        }
        if (loader == null) {
            loader = Environment.class.getClassLoader();
            if (loader == null) {
                try {
                    // getClassLoader() returning null indicates the bootstrap ClassLoader
                    loader = ClassLoader.getSystemClassLoader();
                } catch (Exception e) {
                    // Cannot access system ClassLoader - oh well, maybe the caller can live with null...
                }
            }
        }
        return loader;
    }
441985
static JClassLoader getSystemClassLoader()
  {
    if (_staticClassLoader == null)
      _staticClassLoader = JClassLoaderWrapper.create(ClassLoader.getSystemClassLoader());

    return _staticClassLoader;
  }
1017595
public static String getLocalClassPath(ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        return ((EnvironmentClassLoader) loader).getLocalClassPath();
      }
    }
    
    return DynamicClassLoader.getSystemClassPath();
  }
1050886
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException {
        return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader());
    }
659186
public static URL getResource(String name) {
        URL resource = null;
        try {
            if (Thread.currentThread().getContextClassLoader() != null) {
                resource = Thread.currentThread().getContextClassLoader().getResource(name);
            }
        } catch (SecurityException e) {
            LOG.info("Unable to access context classloader, using default. " + e.getMessage());
        }
        if (resource == null) {
            resource = ResourceLoader.class.getResource("/" + name);
        }
        return resource;
    }
1297595
public static Class forName(String name) throws ClassNotFoundException {
		// try with caller classloader
		ClassLoader loader = getClassLoaderContextAt(3);
		try {
			return Class.forName(name, true, loader);
		} catch (ClassNotFoundException e) {
			// try with context classloader if set & different
			ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
			if (contextLoader == null || contextLoader == loader) {
				throw e;
			} else {
				return Class.forName(name, true, contextLoader);
			}
		}
	}
41656
@Override
    public ClassLoader getClassLoader() {
        ClassLoader classLoader = this.initialClass.getClassLoader();
        if (classLoader == null) {
            classLoader = application.getClassLoader();
        }
        return classLoader;
    }
1044245
@Override
  public ClassLoader getClassLoader() {
    URL[] urlsForClassLoader = new URL[urls.size()];
    urls.toArray(urlsForClassLoader);

    URLClassLoader classLoader = new URLClassLoader(urlsForClassLoader);
    Thread.currentThread().setContextClassLoader(classLoader);

    return classLoader;
  }
663736
private static ClassLoader getClassLoader() {
		ClassLoader ret = Thread.currentThread().getContextClassLoader();
		return ret != null ? ret : PathKit.class.getClassLoader();
	}
924325
@Override
    public String getClassLoaderIdentifier(ClassLoader classloader) throws IllegalArgumentException {
        // Disable for bundles, because the bundle id can change across instances of the server,
        // meaning the identifier would not be reliable
        if (classloader instanceof ThreadContextClassLoader && !(classloader instanceof ThreadContextClassLoaderForBundles)) {
            return ((ThreadContextClassLoader) classloader).getKey();
        } else {
            return null;
        }
    }