Multi-threading fixes

Nashorn has some constraints to be used in a multi-threaded environment
The easiest is to create a new Global object on every execution
but that slows down by an order of magnitude each execution.

What we do is configure one engine per thread.
Each engine has its own version of Global and reuses it across
executions.

We also need to compile the scripts for each thread.