eval
Suspends until a script instance can be borrowed, runs block on it, and returns the instance to the pool afterwards, even if block throws.
Only the wait for an instance is cancellable. block runs on the calling thread, so once it starts, neither withTimeout nor cancelling the caller can stop it: it runs to completion, holding its instance. Use the overload that takes a timeout for scripts that might not finish.
Return
the result of block
Parameters
the work to do with the borrowed instance
Throws
if the pool has been closed
Like eval, but runs block on a thread of its own and waits at most timeout for it; the wait for an instance does not count toward timeout. If block does not finish in time, its thread is interrupted, the instance is taken out of the pool for good and a fresh one takes its place, and a ScriptTimeoutException is thrown. Cancelling the caller while block runs stops it the same way.
An engine that ignores the interrupt keeps the thread running until the script returns, if it ever does; the instance is closed then.
Return
the result of block
Parameters
how long block may run; must be positive
the work to do with the borrowed instance
Throws
if timeout is not positive
if the pool has been closed