@Singleton public final class ThreadPoolScriptEvaluator extends Object implements ScriptEvaluator
| Constructor and Description |
|---|
ThreadPoolScriptEvaluator(StandardScriptEngineManager scriptEngineManager,
ExecutorService threadPool,
ScriptEvaluator delegate)
Constructs a script evaluator that uses a configurable thread pool to execute scripts, delegating actual script
execution to another script evaluator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindVariableInGlobalScope(String name,
Object object)
Binds the given object to the given variable name in the global scope of all scripts evaluated via this
script evaluator.
|
<T> T |
evaluateScript(ScriptObject script,
Bindings bindings)
This implementation of evaluateScript runs any provided script in its own thread.
|
@Inject public ThreadPoolScriptEvaluator(StandardScriptEngineManager scriptEngineManager, ExecutorService threadPool, ScriptEvaluator delegate)
scriptEngineManager - the manager object to listen for configuration changes. Not null.threadPool - the thread pool to use for evaluating scripts. Not null.delegate - the script evaluator to use to evaluate scripts from the thread pool. Not null.public <T> T evaluateScript(ScriptObject script, Bindings bindings) throws ScriptException
evaluateScript in interface ScriptEvaluatorT - the type of result expected from the script.script - the script to evaluate.bindings - any additional variable bindings to set before running the script.ScriptException - if anything went wrong during the script's executionScriptExceptionGroovyEngineFactorypublic void bindVariableInGlobalScope(String name, Object object)
ScriptEvaluatorbindVariableInGlobalScope in interface ScriptEvaluatorname - the name of the variable to bind the object to.object - the object to bind into the global scope of all scripts.Copyright © 2010–2024 Open Identity Platform Community. All rights reserved.