Package org.jruby.embed
Class IsolatedScriptingContainer
java.lang.Object
org.jruby.embed.ScriptingContainer
org.jruby.embed.IsolatedScriptingContainer
- All Implemented Interfaces:
EmbedRubyInstanceConfigAdapter
- Direct Known Subclasses:
OSGiIsolatedScriptingContainer
The IsolatedScriptingContainer does set GEM_HOME and GEM_PATH and JARS_HOME
in such a way that it uses only resources which can be reached with classloader.
GEM_HOME is uri:classloader://META-INF/jruby.home/lib/ruby/gems/shared
GEM_PATH is uri:classloader://
JARS_HOME is uri:classloader://jars
But whenever you want to set them via
setEnvironment(Map)
this will be honored.
It also allows to add a classloaders to LOAD_PATH or GEM_PATH.
This container also sets option classloader.delegate to false, i.e. the JRubyClassloader
for each runtime will lookup classes first on itself before looking into the parent
classloader.
WARNING: this can give problems when joda-time is used inside the
JRubyClassloader or with current version of nokogiri (1.6.7.2) as it uses
(sun-)jdk classes which conflicts with classes nokogiri loaded into the
JRubyClassloader.
With any classloader related problem the first thing is to try
container.getProvider().getRubyInstanceConfig().setClassloaderDelegate(true);
to solve it.-
Constructor Summary
ConstructorsConstructorDescriptionIsolatedScriptingContainer
(LocalContextScope scope, LocalVariableBehavior behavior) IsolatedScriptingContainer
(LocalContextScope scope, LocalVariableBehavior behavior, boolean lazy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
setEnvironment
(Map environment) Changes an environment variables' map.Methods inherited from class org.jruby.embed.ScriptingContainer
addClassLoader, addGemPath, addGemPath, addLoadPath, addLoadPath, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, callSuper, clear, finalize, get, get, getArgv, getAttribute, getAttributeMap, getClassLoader, getClassloaderDelegate, getCompileMode, getCurrentDirectory, getEnvironment, getErr, getError, getErrorWriter, getHomeDirectory, getIn, getInput, getInstance, getJitLogEvery, getJitMax, getJitMaxSize, getJitThreshold, getKCode, getLoadPaths, getLoadServiceCreator, getOut, getOutput, getProfile, getProfileOutput, getProfilingMode, getProperty, getProvider, getReader, getRecordSeparator, getRuntime, getScriptFilename, getSupportedRubyVersion, getVarMap, getWriter, isNativeEnabled, isObjectSpaceEnabled, isRunRubyInProcess, newObjectAdapter, newRuntimeAdapter, parse, parse, parse, parse, put, put, remove, remove, removeAttribute, resetErrorWriter, resetWriter, runRubyMethod, runRubyMethod, runScriptlet, runScriptlet, runScriptlet, runScriptlet, setArgv, setAttribute, setClassLoader, setClassloaderDelegate, setCompileMode, setCurrentDirectory, setError, setError, setErrorWriter, setHomeDirectory, setInput, setInput, setJitLogEvery, setJitMax, setJitMaxSize, setJitThreshold, setKCode, setLoadPaths, setLoadServiceCreator, setNativeEnabled, setObjectSpaceEnabled, setOutput, setOutput, setProfile, setProfile, setProfileOutput, setProfilingMode, setReader, setRecordSeparator, setRunRubyInProcess, setScriptFilename, setWriter, terminate
-
Constructor Details
-
IsolatedScriptingContainer
public IsolatedScriptingContainer() -
IsolatedScriptingContainer
-
IsolatedScriptingContainer
-
IsolatedScriptingContainer
-
IsolatedScriptingContainer
public IsolatedScriptingContainer(LocalContextScope scope, LocalVariableBehavior behavior, boolean lazy)
-
-
Method Details
-
setEnvironment
Description copied from class:ScriptingContainer
Changes an environment variables' map. Call this method before you use put/get, runScriptlet, and parse methods so that initial configurations will work.- Specified by:
setEnvironment
in interfaceEmbedRubyInstanceConfigAdapter
- Overrides:
setEnvironment
in classScriptingContainer
- Parameters:
environment
- a new map of environment variables.
-