@@ -76,6 +76,8 @@ public class RubyScriptNodeModel extends NodeModel {
7676
7777 private boolean m_snippetMode ;
7878
79+ private static Object m_ScriptingContainerLock = new Object ();
80+
7981 public class ScriptError {
8082 public int lineNum ;
8183 public int columnNum ;
@@ -272,7 +274,14 @@ protected final BufferedDataTable[] execute(final BufferedDataTable[] inData,
272274
273275 // File(RubyScriptNodeModel.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString();
274276
275- ScriptingContainer container = new ScriptingContainer (
277+ ScriptingContainer container ;
278+
279+ // **** JRuby 1.7.13 workaround ******
280+ // Container creation is failed for the first of two parallel executed.
281+ // Fails only first time!
282+ // ***********************************
283+ synchronized (m_ScriptingContainerLock ){
284+ container = new ScriptingContainer (
276285 LocalContextScope .THREADSAFE );
277286 container .setCompatVersion (CompatVersion .RUBY2_0 );
278287 container .setCompileMode (CompileMode .JIT );
@@ -285,7 +294,7 @@ protected final BufferedDataTable[] execute(final BufferedDataTable[] inData,
285294 NodeLogger .LEVEL .WARN ));
286295 container .setError (new LoggerOutputStream (m_logger ,
287296 NodeLogger .LEVEL .ERROR ));
288-
297+
289298 // ********** Configuring of global variables ***************
290299 container .put ("$num_inputs" , m_numInputs );
291300 container .put ("$input_datatable_arr" , inData );
@@ -308,6 +317,7 @@ protected final BufferedDataTable[] execute(final BufferedDataTable[] inData,
308317
309318 container .put ("$exec" , exec );
310319 container .put ("PLUGIN_PATH" , rubyPluginPath );
320+ }
311321
312322 // ********** Script execution ***************
313323 String script_fn = "node_script.rb" ;
0 commit comments