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.
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?