You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2011/02/09 17:19:57 UTC
[jira] Created: (SLING-1975) ScriptEngineFactory implementations
should declare their threading support
ScriptEngineFactory implementations should declare their threading support
--------------------------------------------------------------------------
Key: SLING-1975
URL: https://issues.apache.org/jira/browse/SLING-1975
Project: Sling
Issue Type: Improvement
Components: Scripting
Affects Versions: Scripting Java 2.0.0, Scripting JavaScript 2.0.10, Scripting JSP 2.0.14
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: Scripting JSP 2.0.16, Scripting JavaScript 2.0.12, Scripting Java 2.0.2
Our main script engines should declare in their ScriptEngineFactory implementations their behaviour with respect to multi thread as described in Section SCR.4.3.5.2 Metadata Methods of the JSR-223 Java Script API specification:
Multithreaded Engine
Multi-threaded Evaluation - The implementation of the API and the engine itself are capable of supporting concurrent evaluations by multiple threads on a single engine instance. However the exact behavior of such concurrent execution is ultimately determined by the script or scripts themselves. An engine which supports concurrent execution is "multi-threaded" in the same sense that the Java language is "multi-threaded": Evaluation by concurrent threads is allowed and produces side effects that can be seen by other threads. The threads may interact or not interact, utilize synchronization or not utilize synchronization, in scripting language dependent ways.
Thread-Isolated Engine
Satisfies the requirements for Multithreaded. Also, the side-effects for threads are isolated from one another. Specifically, the isolation limits the visibility of changes to the state of variables in the engine scope of the interpreter. Each thread will effectively have its own thread-local engine scope for the engine instance. Note that this does not limit the visibility of side effects outside the engine scope - for example, mutation of application-level Java objects.
Stateless Engine
Satisfies the requirements for Thread-Isolated. In addition, the mappings in the Bindings used as the engine scope of the ScriptEngine are not modified by any ScriptExecution. The keys in the Bindings and their associated values are exactly the same before and after each script execution.
>From this description, I would say :
JavaScript is Multithreaded because as of SLING-1972 the variables are written back to the Engine scope bindings of the ScriptEngine instance (to support the SLING-1111 use case)
JSP is state less because the Engine scope bindings are not modified by the ScriptEngine
Java is state less because the Engine scope bindings are not modified by the ScriptEngine
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (SLING-1975) ScriptEngineFactory implementations
should declare their threading support
Posted by "Justin Edelson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-1975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Edelson closed SLING-1975.
---------------------------------
> ScriptEngineFactory implementations should declare their threading support
> --------------------------------------------------------------------------
>
> Key: SLING-1975
> URL: https://issues.apache.org/jira/browse/SLING-1975
> Project: Sling
> Issue Type: Improvement
> Components: Scripting
> Affects Versions: Scripting JSP 2.0.14, Scripting JavaScript 2.0.10, Scripting Java 2.0.0
> Reporter: Felix Meschberger
> Assignee: Felix Meschberger
> Fix For: Scripting JSP 2.0.16, Scripting JavaScript 2.0.12, Scripting Java 2.0.2
>
>
> Our main script engines should declare in their ScriptEngineFactory implementations their behaviour with respect to multi thread as described in Section SCR.4.3.5.2 Metadata Methods of the JSR-223 Java Script API specification:
> Multithreaded Engine
> Multi-threaded Evaluation - The implementation of the API and the engine itself are capable of supporting concurrent evaluations by multiple threads on a single engine instance. However the exact behavior of such concurrent execution is ultimately determined by the script or scripts themselves. An engine which supports concurrent execution is "multi-threaded" in the same sense that the Java language is "multi-threaded": Evaluation by concurrent threads is allowed and produces side effects that can be seen by other threads. The threads may interact or not interact, utilize synchronization or not utilize synchronization, in scripting language dependent ways.
> Thread-Isolated Engine
> Satisfies the requirements for Multithreaded. Also, the side-effects for threads are isolated from one another. Specifically, the isolation limits the visibility of changes to the state of variables in the engine scope of the interpreter. Each thread will effectively have its own thread-local engine scope for the engine instance. Note that this does not limit the visibility of side effects outside the engine scope - for example, mutation of application-level Java objects.
> Stateless Engine
> Satisfies the requirements for Thread-Isolated. In addition, the mappings in the Bindings used as the engine scope of the ScriptEngine are not modified by any ScriptExecution. The keys in the Bindings and their associated values are exactly the same before and after each script execution.
> From this description, I would say :
> JavaScript is Multithreaded because as of SLING-1972 the variables are written back to the Engine scope bindings of the ScriptEngine instance (to support the SLING-1111 use case)
> JSP is state less because the Engine scope bindings are not modified by the ScriptEngine
> Java is state less because the Engine scope bindings are not modified by the ScriptEngine
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (SLING-1975) ScriptEngineFactory implementations
should declare their threading support
Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SLING-1975?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Felix Meschberger resolved SLING-1975.
--------------------------------------
Resolution: Fixed
Fixed in Rev. 1068960 (JSP, Java) and 1068961 (JavaScript)
> ScriptEngineFactory implementations should declare their threading support
> --------------------------------------------------------------------------
>
> Key: SLING-1975
> URL: https://issues.apache.org/jira/browse/SLING-1975
> Project: Sling
> Issue Type: Improvement
> Components: Scripting
> Affects Versions: Scripting JSP 2.0.14, Scripting JavaScript 2.0.10, Scripting Java 2.0.0
> Reporter: Felix Meschberger
> Assignee: Felix Meschberger
> Fix For: Scripting JSP 2.0.16, Scripting JavaScript 2.0.12, Scripting Java 2.0.2
>
>
> Our main script engines should declare in their ScriptEngineFactory implementations their behaviour with respect to multi thread as described in Section SCR.4.3.5.2 Metadata Methods of the JSR-223 Java Script API specification:
> Multithreaded Engine
> Multi-threaded Evaluation - The implementation of the API and the engine itself are capable of supporting concurrent evaluations by multiple threads on a single engine instance. However the exact behavior of such concurrent execution is ultimately determined by the script or scripts themselves. An engine which supports concurrent execution is "multi-threaded" in the same sense that the Java language is "multi-threaded": Evaluation by concurrent threads is allowed and produces side effects that can be seen by other threads. The threads may interact or not interact, utilize synchronization or not utilize synchronization, in scripting language dependent ways.
> Thread-Isolated Engine
> Satisfies the requirements for Multithreaded. Also, the side-effects for threads are isolated from one another. Specifically, the isolation limits the visibility of changes to the state of variables in the engine scope of the interpreter. Each thread will effectively have its own thread-local engine scope for the engine instance. Note that this does not limit the visibility of side effects outside the engine scope - for example, mutation of application-level Java objects.
> Stateless Engine
> Satisfies the requirements for Thread-Isolated. In addition, the mappings in the Bindings used as the engine scope of the ScriptEngine are not modified by any ScriptExecution. The keys in the Bindings and their associated values are exactly the same before and after each script execution.
> From this description, I would say :
> JavaScript is Multithreaded because as of SLING-1972 the variables are written back to the Engine scope bindings of the ScriptEngine instance (to support the SLING-1111 use case)
> JSP is state less because the Engine scope bindings are not modified by the ScriptEngine
> Java is state less because the Engine scope bindings are not modified by the ScriptEngine
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira