{
storage = new ConcurrentHashMap<Class<T>, ScriptingContainer>();
context.setAttribute(CONTAINER_STORE_KEY, storage);
}
ScriptingContainer cachedContainer = storage.get(getTransformerType());
if (cachedContainer == null)
{
cachedContainer = new ScriptingContainer(LocalContextScope.CONCURRENT, LocalVariableBehavior.TRANSIENT);
cachedContainer.setRunRubyInProcess(false);
storage.put(getTransformerType(), cachedContainer);
// the user may have set a custom CompileMode
if (compileMode != null) {
cachedContainer.setCompileMode(compileMode);
}
// the user may have set a customn CompatVersion
if (compatVersion != null) {
cachedContainer.setCompatVersion(compatVersion);
}
// scripts typically need to set the load path for 3rd party gems
List<String> loadPaths = getLoadPaths();
if (loadPaths != null && !loadPaths.isEmpty()) {
cachedContainer.getLoadPaths().addAll(loadPaths);
}
// perform custom initialization of the container
prepareContainer(cachedContainer);
}