testRuleWithIterationUsingLibrary() and testComplexRuleInLibrary() and testLoadScriptRatherThanFile()tests for examples. Nashorn isn’t threadsafe, but the rule engine is! Internally it uses a pool of Nashorn engines. You can also override the pool configuration
if you need to. See the
testMultithreadingAndPerformance_NoProblemsExpectedBecauseScriptsAreStateless()tests for examples. If required, you can get the engine to preload the pool, or leave it lazily fill the pool (default). Please note, the engine is not completely Rhino (Java 6 / Java 7) compatible – the multithreaded tests do not work as expected for stateful scripts, but the performance of Rhino is so bad that you won’t want to use it anyway.
- You can now override the name of the input parameter – previous versions required that the rules refer to the input as “input”, for example “input.people.name == ‘Jane'”. You can now provide the engine with the name which should be used, so that you can create rules like
“company.people.name == ‘Jane'”.
- For your convenience, there are now builders for the
testBuilder()test for an example.
or Java notation (e.g. “
The library is available from Maven Central:
Copyright ©2015, Ant Kutschera