NIFI-1822 Added debugging messages to script execution.

This commit is contained in:
Andy LoPresto 2016-05-13 19:06:53 -07:00
parent 8ab0ce59a4
commit 4c174c8ca7
No known key found for this signature in database
GPG Key ID: 3C6EF65B2F7DEF69
1 changed files with 22 additions and 21 deletions

View File

@ -16,26 +16,6 @@
*/ */
package org.apache.nifi.processors.script; 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.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -43,6 +23,25 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; 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"}) @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 " @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(); ScriptEngine scriptEngine = engineQ.poll();
ProcessorLog log = getLogger();
log.info("[REMOVE] After polling engine, Script Engine queue size: " + engineQ.size());
if (scriptEngine == null) { if (scriptEngine == null) {
// No engine available so nothing more to do here // No engine available so nothing more to do here
return; return;
} }
ProcessorLog log = getLogger();
ProcessSession session = sessionFactory.createSession(); ProcessSession session = sessionFactory.createSession();
try { try {
@ -218,6 +218,7 @@ public class ExecuteScript extends AbstractScriptProcessor {
throw t; throw t;
} finally { } finally {
engineQ.offer(scriptEngine); engineQ.offer(scriptEngine);
log.info("[REMOVE] After offering engine, Script Engine queue size: " + engineQ.size());
} }
} }
} }