Make groovy engine service always delegate instrumentation
@@ -23,15 +23,15 @@ package net.grinder.scriptengine.groovy;
import net.grinder.common.GrinderProperties;
import net.grinder.engine.common.EngineException;
import net.grinder.engine.common.ScriptLocation;
-import net.grinder.engine.process.JavaDCRInstrumenterEx;
import net.grinder.scriptengine.DCRContext;
import net.grinder.scriptengine.Instrumenter;
import net.grinder.scriptengine.ScriptEngineService;
import net.grinder.util.FileExtensionMatcher;
-import java.util.ArrayList;
import java.util.List;
+import static java.util.Collections.emptyList;
+
/**
* Groovy script engine service.
*
@@ -44,7 +44,6 @@ public class GroovyScriptEngineService implements ScriptEngineService {
@SuppressWarnings("unused")
private final boolean m_forceDCRInstrumentation;
- private final DCRContext m_dcrContext;
/**
* Constructor.
@@ -53,9 +52,7 @@ public class GroovyScriptEngineService implements ScriptEngineService {
* @param dcrContext DCR context.
* @param scriptLocation Script location.
*/
- public GroovyScriptEngineService(GrinderProperties properties, //
- DCRContext dcrContext, ScriptLocation scriptLocation) {
-
+ public GroovyScriptEngineService(GrinderProperties properties, DCRContext dcrContext, ScriptLocation scriptLocation) {
// This property name is poor, since it really means "If DCR
// instrumentation is available, avoid the traditional Jython
// instrumenter". I'm not renaming it, since I expect it only to last
@@ -63,15 +60,12 @@ public class GroovyScriptEngineService implements ScriptEngineService {
m_forceDCRInstrumentation = properties.getBoolean("grinder.dcrinstrumentation", false)
// Hack: force DCR instrumentation for non-Jython scripts.
|| m_groovyFileMatcher.accept(scriptLocation.getFile());
-
- m_dcrContext = dcrContext;
}
/**
* Constructor used when DCR is unavailable.
*/
public GroovyScriptEngineService() {
- m_dcrContext = null;
m_forceDCRInstrumentation = false;
}
@@ -80,19 +74,7 @@ public class GroovyScriptEngineService implements ScriptEngineService {
*/
@Override
public List<Instrumenter> createInstrumenters() {
-
- final List<Instrumenter> instrumenters = new ArrayList<>();
-
- /*
- * if (!m_forceDCRInstrumentation) {
- * System.out.println("m_forceDCRInstrumentation is false."); // must using Instrumentation
- * }
- */
- if (m_dcrContext != null) {
- instrumenters.add(new JavaDCRInstrumenterEx(m_dcrContext));
- }
-
- return instrumenters;
+ return emptyList();
}
/**
