Skip to content

Instantly share code, notes, and snippets.

@yokolet
Created February 5, 2010 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokolet/296317 to your computer and use it in GitHub Desktop.
Save yokolet/296317 to your computer and use it in GitHub Desktop.
--- a/src/org/jruby/Ruby.java
+++ b/src/org/jruby/Ruby.java
@@ -195,6 +195,23 @@ public final class Ruby {
private static Ruby globalRuntime;
+ /**
+ * Tests whether globalRuntime has been instantiated or not.
+ *
+ * This method is used by singleton model of org.jruby.embed.ScriptingContainer
+ * to decide what RubyInstanceConfig should be used. When a global runtime is
+ * not there, RubyInstanceConfig of AbstractContextProvider will be used to enac
+ * configurations set by a user. When a global runtime is already instantiated,
+ * RubyInstanceConfig of the global runtime should be used in ScriptingContaiene
+ *
+ * @return true if a global runtime is instantiated, false for other.
+ *
+ */
+ public static boolean isGlobalRuntimeReady() {
+ if (globalRuntime == null) return false;
+ else return true;
+ }
+
private static synchronized void setGlobalRuntimeFirstTimeOnly(Ruby runtime) {
if (globalRuntime == null) {
globalRuntime = runtime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment