Rules and concurrency

I just read this:

https://wiki.openjdk.org/display/Nashorn/Nashorn+jsr223+engine+notes

Despite Nashorn being old and all that, it seems to me like the engine/context concepts are more like I initially thought after all. It appears to me like it should be possible to create contexts that are entirely independent, where globals would “live inside that context” and not be linked to the engine instance. But, I don’t know if that applies to Nashorn in particular, or JSR223 in general. It seems, at least, like it’s possible to create a context from scratch, that isn’t in any way “linked” to the engine’s default context.

When a (map) transformation reuses a thread, when runs in a different thread?

I want to describe in openhab-docs when a transformation can run in parallel to itself and when not. I have modified transform.map to be slow and described my findings at concept/rules: state that a rule cannot be executed in parallel by dilyanpalauzov · Pull Request #2573 · openhab/openhab-docs · GitHub : sometimes the same transformation reuses the thread, that is: waits for itself to end, before starting over; and sometimes uses a different thread (runs in parallel to itself).

The example has several items in a sitemap, all of the items linked to the same mqtt channel and using the same transformation.

How should the documentation be extended to describe when a transformation reuses a thread (runs sequentially to itself) and when the transformation uses a different thread (starts running, before it has stopped running)?

To answer that, I guess somebody must first do the work of figuring out the details of how this is regulated. I doubt anybody knows this already, there’s quite a lot of code to remember to keep such things in your memory. I typically only have such an overview while I work on something, later I might have some vague ideas, but I can’t explain exactly how or why. To do that, I’ll have to dig in again and refresh all the details.

So, I guess it boils down to: Is getting the exact details documented important enough that somebody is willing to invest the time needed to figure this out?