Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
putting the jruby-classloader as context classloader means that all a…
Browse files Browse the repository at this point in the history
…ttached "jars" can be found via

the Thread.currentThread.contextClassLoader. running jruby from other environments like servlets just
leave the context classloader as is. so this was a commandline only feature.

finally it keeps the classloader semantic uniform wether executed from commandline or inside a j2ee container
or osgi framework or embedded jruby in a java application
mkristian committed Oct 7, 2014
1 parent e09f484 commit e063c55
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions core/src/main/java/org/jruby/Main.java
Original file line number Diff line number Diff line change
@@ -283,8 +283,6 @@ public void run() {
}

try {
doSetContextClassLoader(runtime);

if (in == null) {
// no script to run, return success
return new Status();
@@ -452,18 +450,6 @@ private boolean checkStreamSyntax(Ruby runtime, InputStream in, String filename)
}
}

private void doSetContextClassLoader(Ruby runtime) {
// set thread context JRuby classloader here, for the main thread
try {
Thread.currentThread().setContextClassLoader(runtime.getJRubyClassLoader());
} catch (SecurityException se) {
// can't set TC classloader
if (runtime.getInstanceConfig().isVerbose()) {
config.getError().println("WARNING: Security restrictions disallowed setting context classloader for main thread.");
}
}
}

private void doProcessArguments(InputStream in) {
config.processArguments(config.parseShebangOptions(in));
}

0 comments on commit e063c55

Please sign in to comment.