Multithreading and Synchronization
Normally, when executing the HTTP requests on behalf of a single Application Designer session, there is no parallel execution in multiple threads (unless the code contributed by a plug-in starts a thread on its own). Hence, access to objects or properties having a scope restricted to the session context does not require any synchronization.
However, when using global / static variables, this is no longer true. Multiple active user sessions may be processed in parallel.
Warning About Using Global Variables
Avoid usage of global variables, which might lead to the following issues:
Synchronization is required otherwise non-reproducible race conditions will result.
Memory leakages if global collections that grow for each session are used.
Global references to JAXR-based RegistryObjects. A RegistryObject contains a reference to the JAXR-based Connection (including the underlying credentials) that had been used to load it. When resolving a secondary reference either of the following may happen:
If the connection is still open, credentials of another user will be used, thus causing a security hole.
If the connection is no longer open, a corresponding exception will be thrown (
trying to use a closed connection).