Trivadis / plsql-formatter-settings

PL/SQL & SQL formatter settings based on the Trivadis PL/SQL & SQL Coding Guidelines
Apache License 2.0
134 stars 46 forks source link

Add timeout parameter in standalone formatter #247

Closed PhilippSalvisberg closed 1 year ago

PhilippSalvisberg commented 1 year ago

closes #244 .

Timeout is handled in a sandboxed formatter using a time limited thread. This requires Java. It's not possible to start new threads from JavaScript. Trying leads to the following exception:

java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Multi threaded access requested by thread Thread[pool-1-thread-1,5,main] but is not allowed for language(s) js.

see

While this seems to be a GraalVM related limitation and not a Nashorn specific one, it make sense to keep the JavaScript code compatible with GraalVM because it's a natural choice when using newer Java versions.

As a result the timeout feature is only available in the standalone formatter.