MCPcopy Index your code
hub / github.com/apache/groovy / setupContextClassLoader

Method setupContextClassLoader

src/main/java/groovy/ui/GroovyMain.java:560–593  ·  view source on GitHub ↗
(GroovyShell shell)

Source from the content-addressed store, hash-verified

558
559 // GROOVY-6771
560 private static void setupContextClassLoader(GroovyShell shell) {
561 final Thread current = Thread.currentThread();
562 /**
563 * Privileged action that updates the thread context class loader.
564 */
565 class DoSetContext implements PrivilegedAction<Object> {
566 /**
567 * Context class loader to install.
568 */
569 ClassLoader classLoader;
570
571 /**
572 * Creates the context-switch action.
573 *
574 * @param loader the class loader to install
575 */
576 DoSetContext(ClassLoader loader) {
577 classLoader = loader;
578 }
579
580 /**
581 * Sets the current thread context class loader.
582 *
583 * @return {@code null}
584 */
585 @Override
586 public Object run() {
587 current.setContextClassLoader(classLoader);
588 return null;
589 }
590 }
591
592 new DoSetContext(shell.getClassLoader()).run();
593 }
594
595 /**
596 * Process the input files.

Callers 2

processFilesMethod · 0.95
processOnceMethod · 0.95

Calls 2

runMethod · 0.65
getClassLoaderMethod · 0.45

Tested by

no test coverage detected