Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cde5bbbea969
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1c19d0cc8b06
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 29, 2015

  1. Copy the full SHA
    6975482 View commit details
  2. make fields final

    kares committed Jul 29, 2015
    Copy the full SHA
    404c14d View commit details
  3. close JRuby's class-loader resources on Java 7+ (but only in embed uses)

    ... for other uses users can now manually trigger a releaseJRubyClassLoader
    kares committed Jul 29, 2015
    Copy the full SHA
    1c19d0c View commit details
514 changes: 263 additions & 251 deletions core/src/main/java/org/jruby/Ruby.java

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions core/src/main/java/org/jruby/embed/ScriptingContainer.java
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.profile.builtin.ProfileOutput;
import org.jruby.util.ClassCache;
import org.jruby.util.JRubyClassLoader;
import org.jruby.util.KCode;
import org.jruby.util.cli.OutputStrings;
import org.jruby.util.cli.Options;
@@ -1900,6 +1901,8 @@ public void terminate() {
LocalContextProvider provider = getProvider();
if (provider.isRuntimeInitialized()) {
provider.getRuntime().tearDown(false);
// NOTE: Ruby#tearDown does getJRubyClassLoader().tearDown()
provider.getRuntime().releaseClassLoader();
}
provider.terminate();
}
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/javasupport/JavaEmbedUtils.java
Original file line number Diff line number Diff line change
@@ -216,8 +216,8 @@ public static interface EvalUnit {
* compiler).
*/
public static class InterpretedEvalUnit implements EvalUnit {
private Ruby runtime;
private Node node;
private final Ruby runtime;
private final Node node;

protected InterpretedEvalUnit(Ruby runtime, Node node) {
this.runtime = runtime;
13 changes: 11 additions & 2 deletions core/src/main/java/org/jruby/util/JRubyClassLoader.java
Original file line number Diff line number Diff line change
@@ -147,9 +147,18 @@ public void tearDown(boolean debug) {
catch (Exception e) {
if (debug) LOG.debug(e);
}
// if we're on Java 7+ call URLClassLoader#close :
}

/**
* Helper to close the JRuby class-loader.
* @param loader
* @note This is internal API, do not rely on it to exists!
*/
public static void close(final JRubyClassLoader loader) {
if ( loader == null ) return;
// URLClassLoader#close only available since Java 7 :
try {
URLClassLoader.class.getMethod("close").invoke(this);
URLClassLoader.class.getMethod("close").invoke(loader);
}
catch (NoSuchMethodException ex) { /* noop on Java 6 */ }
catch (IllegalAccessException ex) {