pgyori commented on a change in pull request #5116:
URL: https://github.com/apache/nifi/pull/5116#discussion_r646653878
##########
File path:
nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java
##########
@@ -253,31 +226,16 @@ public void onTrigger(ProcessContext context,
ProcessSessionFactory sessionFacto
}
}
- scriptEngine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
-
- // Execute any engine-specific configuration before the script
is evaluated
- ScriptEngineConfigurator configurator =
-
scriptingComponentHelper.scriptEngineConfiguratorMap.get(scriptingComponentHelper.getScriptEngineName().toLowerCase());
-
- // Evaluate the script with the configurator (if it exists) or
the engine
- if (configurator != null) {
- configurator.init(scriptEngine, scriptToRun,
scriptingComponentHelper.getModules());
- configurator.eval(scriptEngine, scriptToRun,
scriptingComponentHelper.getModules());
- } else {
- scriptEngine.eval(scriptToRun);
- }
+ scriptRunner.run(bindings);
// Commit this session for the user. This plus the outermost
catch statement mimics the behavior
// of AbstractProcessor. This class doesn't extend
AbstractProcessor in order to share a base
// class with InvokeScriptedProcessor
session.commitAsync();
+ scriptingComponentHelper.scriptRunnerQ.offer(scriptRunner);
} catch (ScriptException e) {
- // Reset the configurator on error, this can indicate to the
configurator to recompile the script on next init()
- ScriptEngineConfigurator configurator =
-
scriptingComponentHelper.scriptEngineConfiguratorMap.get(scriptingComponentHelper.getScriptEngineName().toLowerCase());
- if (configurator != null) {
- configurator.reset();
- }
+ // Create a new ScriptRunner to replace the one that caused an
exception
+ scriptingComponentHelper.setupScriptRunners(1, scriptToRun,
getLogger());
Review comment:
That makes perfect sense. However, ExecuteScript has 1 instance of
ScriptingComponentHelper. If the ExecuteScript processor is set to use 3
concurrent tasks, then 3 ScriptRunner instances get stored in the
scriptingComponentHelper.scriptRunnerQ queue. If one ScriptRunner causes an
exception, the scriptingComponentHelper.scriptRunnerQ queue gets replaced with
a new queue with 1 element in it. Or am I missing something here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]