* New translations openwebnet.properties (Italian)
* New translations jsscripting.properties (Danish)
* New translations hdpowerview.properties (Danish)
* New translations netatmo.properties (Italian)
* New translations danfossairunit.properties (Danish)
* New translations jsscripting.properties (Italian)
* [automation] Code optimization for Java17: instanceof matching and multiline strings
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
* [automation] Make use of Java17 features
Use Map/Set/List.of instead of Collections.
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
* review comment
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
---------
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
It was found out that a recent change to the webpack config for the library injection bundle heavily affected performance of the evaluation of the cached injection.
openhab-js 4.5.1 fixes that regression and one minor bug, see https://github.com/openhab/openhab-js/blob/main/CHANGELOG.md#451.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Fix bundling of global script & regression from #14135
Fixes the regression from https://github.com/openhab/openhab-addons/pull/14135#issuecomment-1369231126.
While working on this, I also noticed that the cache openhab-js does not work because of wrong webpack commandline args in the pom (wrong entrypoint).
* [jsscripting] Enable stack logging for IllegalArgumentExceptions
* [jsscripting] Upgrade openhab-js to 3.2.4
* [jsscripting] Update README for recent PR
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Extend comments for wraprequire
* [jsscripting] Enable openhab-js caching to improve performance
On my dev system (which I guess is much more powerful than most openHAB servers), cached openhab-js injection takes 100-200 ms.
openhab-js injection from file system takes about 1000 ms.
* [jsscripting] Update configuration language
* [jsscripting] Upgrade openhab-js version to 3.2.1 for required webpack changes
Documentation updates will follow in another PR to keep this one clean.
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Share org.graalvm.polyglot.Engine across all OpenhabGraalJSScriptEngine instances
See https://github.com/oracle/graaljs/issues/121#issuecomment-880056648, it is not required to have one engine per GraalJSScriptEngine.
This might improve performance a bit on less powerful systems (Raspberry Pi) and decreases heap usage:
With 5 GraalJS UI scripts, heap usage is now below 100 MB. Before this change, it was over 100 MB.
* [jsscripting] Extend debug logging
* [jsscripting] Cache `@jsscripting-globals.js` across all engines
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* [jsscripting] Remove asm from dependencies in pom
GraalJS >= 20.3.0 doesn't require org.ow2.asm as compile dependency anymore, see https://mvnrepository.com/artifact/org.graalvm.js/js/20.3.0.
* [jsscripting] Remove dependency org.graalvm.js/js-launcher as it is not required
js-launcher is GraalVM's JavaScript command line interpreter and not required in the addon.
See https://www.graalvm.org/22.1/reference-manual/js/RunOnJDK/.
* [jsscripting] Add missing com.ibm.icu dependency
GraalJS changelog says that it is not required for GraalJS >= 22.0.0 (see 685e5873af/CHANGELOG.md (version-2200)).
But GraalJS 22.3.0 attempts to load classes from it during runtime.
* [jsscripting] Update GraalJS engine options
Compat, as its additional functionality is not used by openhab-js and user code is not expected to use it.
* [jsscripting] Remove com.ibm.icu/icu4j dependency
* [jsscripting] Don't disable Nashorn compat mode as openhab-js requires it for accessors
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
* New translations knx.properties (German)
* New translations yamahamusiccast.properties (German)
* New translations hdpowerview.properties (Danish)
* New translations jsscripting.properties (Danish)
* New translations chromecast.properties (Italian)
* New translations sonos.properties (Italian)
* New translations exec.properties (Italian)
* New translations knx.properties (German)
* New translations jsscripting.properties (German)
* New translations yamahamusiccast.properties (German)
* [jsscripting] Extend synchronization to common ScriptEngine methods
This extends the multi-thread synchronization to "eval" and "invokeMethod" and moves synchronization for "invokeFunction" to the DelegatingScriptEngineWithInvocableAndAutocloseableAndSynchronization class. Fixes the multi-thread access requested warnings described in the community (https://community.openhab.org/t/openhab-3-4-milestone-discussion/138093/130) and related to https://github.com/openhab/openhab-core/pull/3180.
* Revert "[jsscripting] Extend synchronization to common ScriptEngine methods"
This reverts commit aadd21e45879c10aad29bf279ddbb0afd789b0aa.
* [jsscripting] Extend synchronization to common ScriptEngine methods & Switch to ReentrantLock
This extends the multi-thread synchronization to "eval" and "invokeMethod" and moves synchronization for "invokeFunction" to the InvocationInterceptingScriptEngineWithInvocableAndAutoCloseable class.
The synchronization mechanism changed from using synchronized to using a ReentrantLock together with catch_finally to avoid having deadlocks when an exception is thrown.
Fixes the multi-thread access requested warnings described in the community (https://community.openhab.org/t/openhab-3-4-milestone-discussion/138093/130) and related to https://github.com/openhab/openhab-core/pull/3180.
* [jsscripting] Reduce compiler warnings
* [jsscripting] Replace finally blocks & Wrap returns in afterInvocation
* [jsscripting] Fix deadlock caused by NoSuchMethodException in Invocable interface methods
During testing my latest changes, I noticed that there is a deadlock when invokeFunction or invokeMethod are called on a non-existing method.
This happens because the NoSuchMethodException keeps afterInvocation from running and therefore the lock never gets released.
* [jsscripting] Also rethrow NPE & Fix PMD warnings/errors
* [jsscripting] Wrap and rethrow other exceptions instead of returning them
* [jsscripting] Address review comment from @jpg0
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
In recent PR #13824, I added closing the context when the engine is closed, but core seems to have problems with that.
It logs: "[ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error removing ScriptEngine
java.lang.IllegalStateException: The Context is already closed."
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>