From 4c174c8ca76f5a9e64aa2bd2469ca2966c90b888 Mon Sep 17 00:00:00 2001 From: Andy LoPresto Date: Fri, 13 May 2016 19:06:53 -0700 Subject: [PATCH] NIFI-1822 Added debugging messages to script execution. --- .../nifi/processors/script/ExecuteScript.java | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java index 7d5ee5225a..ac450bd787 100644 --- a/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java +++ b/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ExecuteScript.java @@ -16,26 +16,6 @@ */ package org.apache.nifi.processors.script; -import org.apache.commons.io.IOUtils; -import org.apache.nifi.annotation.behavior.DynamicProperty; -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.logging.ProcessorLog; -import org.apache.nifi.annotation.lifecycle.OnScheduled; -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.processor.ProcessContext; -import org.apache.nifi.processor.ProcessSession; -import org.apache.nifi.processor.ProcessSessionFactory; -import org.apache.nifi.processor.Relationship; -import org.apache.nifi.processor.exception.ProcessException; -import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.util.StringUtils; - -import javax.script.Bindings; -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptException; -import javax.script.SimpleBindings; import java.io.FileInputStream; import java.io.IOException; import java.util.Collections; @@ -43,6 +23,25 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import javax.script.Bindings; +import javax.script.ScriptContext; +import javax.script.ScriptEngine; +import javax.script.ScriptException; +import javax.script.SimpleBindings; +import org.apache.commons.io.IOUtils; +import org.apache.nifi.annotation.behavior.DynamicProperty; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnScheduled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.logging.ProcessorLog; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.ProcessSessionFactory; +import org.apache.nifi.processor.Relationship; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.util.StringUtils; @Tags({"script", "execute", "groovy", "python", "jython", "jruby", "ruby", "javascript", "js", "lua", "luaj"}) @CapabilityDescription("Experimental - Executes a script given the flow file and a process session. The script is responsible for " @@ -162,11 +161,12 @@ public class ExecuteScript extends AbstractScriptProcessor { } } ScriptEngine scriptEngine = engineQ.poll(); + ProcessorLog log = getLogger(); + log.info("[REMOVE] After polling engine, Script Engine queue size: " + engineQ.size()); if (scriptEngine == null) { // No engine available so nothing more to do here return; } - ProcessorLog log = getLogger(); ProcessSession session = sessionFactory.createSession(); try { @@ -218,6 +218,7 @@ public class ExecuteScript extends AbstractScriptProcessor { throw t; } finally { engineQ.offer(scriptEngine); + log.info("[REMOVE] After offering engine, Script Engine queue size: " + engineQ.size()); } } }