Adam Mc
2015-02-10 01:57:38 UTC
Hi,
I am very new to Groovy, and I am trying to understand how default bindings
work for the GroovyScriptEngine.
If I have a single GroovyScriptEngine instance that is called from multiple
threads, and each time I run the the engine, I do so with a fresh Binding
(see following code). Are those Bindings only visible to the script during
that run of the script, or do the bindings stay around for the life of the
engine? Consider the following:
gse = getSharedInstanceOfGrooveScriptEngine() // psudo code here
Binding binding = new Binding();
binding.setVariable("obj", myObj); // this object is unique for
each run, but bound to same string name
gse.run("test.groovy", binding);
Considering the above code will run from multiple threads at the same time
(but with different instance objects put into the bindings), will concurrent
running scripts see only their own unique objects in the bindings that were
set it its unique "run".
--
View this message in context: http://groovy.329449.n5.nabble.com/Understanding-GroovyScriptEngine-bindings-tp5722441.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I am very new to Groovy, and I am trying to understand how default bindings
work for the GroovyScriptEngine.
If I have a single GroovyScriptEngine instance that is called from multiple
threads, and each time I run the the engine, I do so with a fresh Binding
(see following code). Are those Bindings only visible to the script during
that run of the script, or do the bindings stay around for the life of the
engine? Consider the following:
gse = getSharedInstanceOfGrooveScriptEngine() // psudo code here
Binding binding = new Binding();
binding.setVariable("obj", myObj); // this object is unique for
each run, but bound to same string name
gse.run("test.groovy", binding);
Considering the above code will run from multiple threads at the same time
(but with different instance objects put into the bindings), will concurrent
running scripts see only their own unique objects in the bindings that were
set it its unique "run".
--
View this message in context: http://groovy.329449.n5.nabble.com/Understanding-GroovyScriptEngine-bindings-tp5722441.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email