public void initialize() {
		m_statisticsServices = StatisticsServicesImplementation.getInstance();
		List<Instrumenter> list = new ArrayList<>();

		DCRContextImplementation context = DCRContextImplementation.create(LOGGER);
		if (context == null) {
			String file = ExposeInstrumentation.class.getProtectionDomain().getCodeSource().getLocation().getPath();
			file = new File(file).getAbsolutePath();
			throw new RuntimeException("Please add \r\n-javaagent:" + file + "\r\nin 'Run As JUnit' vm argument.");
		}
		list.add(new JavaDCRInstrumenterEx(context));
		final Instrumenter instrumenter = new MasterInstrumenter(list);

		TestStatisticsHelperImplementation m_testStatisticsHelper = new TestStatisticsHelperImplementation(m_statisticsServices.getStatisticsIndexMap());

		TestRegistryImplementation m_testRegistryImplementation = new TestRegistryImplementation(m_threadContexts,
				m_statisticsServices.getStatisticsSetFactory(), m_testStatisticsHelper,
				m_times.getTimeAuthority());

		m_testRegistryImplementation.setInstrumenter(instrumenter);

		final Logger externalLogger = new ExternalLogger(LOGGER, m_threadContexts);

		Sleeper m_sleeper = new SleeperImplementation(m_times.getTimeAuthority(), externalLogger, 1.0d, 0.2d);

		final Statistics scriptStatistics = new ScriptStatisticsImplementation(m_threadContexts, m_statisticsServices,
				new NullSender());

		final InternalScriptContext scriptContext = new ScriptContextImplementation(new SimpleWorkerIdentity(
				"unit-test", 0), new SimpleWorkerIdentity("unit-test", 0), m_threadContexts, null,
				externalLogger, m_sleeper, new SSLControlImplementation(m_threadContexts), scriptStatistics,
				m_testRegistryImplementation, null, null, null, null);
		Grinder.grinder = scriptContext;

		new PluginRegistryImplementation(externalLogger, scriptContext, m_threadContexts, m_statisticsServices,
				m_times.getTimeAuthority());

	}
Initialize thread context. This method is subject to be executed once in the total execution
context.
ngrinder-groovy/src/main/java/net/grinder/engine/process/JUnitThreadContextInitializer.java