Specifications

Script expressions
Script expressions may be evaluated in parallel with each other and with other scripts. Script
expressions should not have side effects (other than issuing log messages) so this parallelism
should not cause any problems.
Terminology
In the following discussion it is important to differentiate between a script package (that is, the
definition of a script) and the script instances created by associating a script package with a flow
element (through a script element or a scripted plug-in). There may be several script instances
for a particular script package.
Execution modes
The script declaration defines the execution mode for all instances of the script package as one
of these choices:
Serialized: entry points for all script instances in the same execution group are never invoked
concurrently.
Concurrent: entry points for the same or different script instances of the script may be executed
concurrently.
Persistent: entry points are invoked in the same “private” thread (and thus are inherently
serialized), and some information can be preserved between invocations.
Concurrent
In concurrent execution mode, the entry points for the same or different script instances of the
script may be called concurrently. In other words, two or more script instances of the same type
may run in parallel and even two or more entry points for a particular script instance may run
in parallel (for example, the jobArrived and timerFired entry points).
For example, a flow containing a single flow element with a concurrent script (in addition to
input/output folders) will pick up and process multiple input jobs at the same time – within the
overall processing limits configured through user preferences.
Script implementations with concurrent execution mode must take care to synchronize access
to resources that are shared between script instances or between different entry points. For
example, access to a text file that is updated from both the jobArrived and timerFired entry
points should be synchronized using the Environment.lock/unlockGlobalData() functions.
Serialized
In serialized execution mode, entry points for script instances in the same execution group are
never called concurrently. In other words, script instances in the same execution group are
executed one after another. Still, the entry points in script instances outside of the execution
group may be executing in parallel with those in the group.
Script implementations that need to be serialized between each other (perhaps because they
use a common external resource) should refer to the same execution group. Usually however a
script implementation needs serialization only with itself. In that case, the execution group
name should be unique to the script implementation.
Persistent
In persistent execution mode:
All entry points for all script instances in the same execution group are executed in the same
thread (except for cleanupAfterAbort), and thus by definition execution is serialized (in
356
Enfocus Switch 10