Update the worker thread jmeter context with the main thread one
@param isInit if true the context a full copy is done, if false only update is done
199906
private void syncContext(boolean isInit)
    {
    	// jmeter context synchronisation
    	JMeterContext current = JMeterContextService.getContext();
		JMeterContext ctx = this.getThreadContext();
		
		if (isInit)
		{
			current.setCurrentSampler(ctx.getCurrentSampler());
			current.setEngine(ctx.getEngine());
			current.setRestartNextLoop(ctx.isRestartNextLoop());
			current.setSamplingStarted(ctx.isSamplingStarted());
			current.setThread(ctx.getThread());
			current.setThreadGroup(ctx.getThreadGroup());
			current.setThreadNum(ctx.getThreadNum());
		}
		current.setVariables(ctx.getVariables());
		current.setPreviousResult(ctx.getPreviousResult());
		//current.getSamplerContext().putAll(ctx.getSamplerContext());
    }
707742
def with_thread_pool(self, init_func=None, only_read=False):
        
        if not hasattr(self, 'thread_pool') or self.thread_pool is None:
            if init_func is not None:
                self.thread_pool = init_func()
            else:
                self.thread_pool = _init_thread_pool()
            self.enable_thread_pool = True
            self.logger.debug('Initialize thread pool completed %s' % self.thread_pool)
            return True
        else:
            self.logger.warning('Already have a thread pool instance - %s' % self.thread_pool)
            return False
1184239
public void threadStarted(ThreadPool tp, int activeThreads, int maxThreads)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "threadStarted", new Object[]{tp, new Integer(activeThreads), new Integer(maxThreads)});
    
    if (TraceComponent.isAnyTracingEnabled() && (tc.isDebugEnabled() || tc.isDumpEnabled() || tc.isEntryEnabled() || tc.isEventEnabled()))
      SibTr.push(_messageProcessor.getMessagingEngine());  
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "threadStarted");
  }
1215220
public function dispatchPostInit()
    {
        if (!$this->postInitRun && $this->context) {
            $this->postInitRun = true;
            $this->dispatcher->dispatch(SiteEvents::EVENT_POST_INIT, new SiteEvent($this->context));
        }
    }
1071052
@Override
    public void postInitModule() throws ModuleInitializationException {
        ManagementDelegate delegate = serverInterface.getManagementDelegate();
        if (delegate == null) {
            throw new ModuleInitializationException("Can't get a ManagementDelegate from Server.getModule()",
                                                    getRole());
        }
        worker.setManagementDelegate(delegate);
    }
1010250
@Override
    protected void onInit() {
        logger.info("DoTaskApp onInit");
        // ConsoleReporters prints S4 metrics
        // MetricsRegistry mr = new MetricsRegistry();
        //
        // CsvReporter.enable(new File(System.getProperty("user.home")
        // + "/monitor/"), 10, TimeUnit.SECONDS);
        // ConsoleReporter.enable(10, TimeUnit.SECONDS);
        try {
            System.err.println();
            System.err.println(Globals.getWorkbenchInfoString());
            System.err.println();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
        S4ComponentFactory factory = new S4ComponentFactory();
        factory.setApp(this);

        // logger.debug("LC {}", lc);

        // task = TaskProvider.getTask(evalTask);

        // EXAMPLE OPTIONS
        // -l Clustream -g Clustream -i 100000 -s (RandomRBFGeneratorEvents -K
        // 5 -N 0.0)
        // String[] args = new String[] {evalTask,"-l", "Clustream","-g",
        // "Clustream", "-i", "100000", "-s", "(RamdomRBFGeneratorsEvents",
        // "-K", "5", "-N", "0.0)"};
        // String[] args = new String[] { evalTask, "-l", "clustream.Clustream",
        // "-g", "clustream.Clustream", "-i", "100000", "-s",
        // "(RandomRBFGeneratorEvents", "-K", "5", "-N", "0.0)" };
        logger.debug("PARAMETERS {}", evalTask);
        // params = params.replace(":", " ");
        List<String> parameters = new ArrayList<String>();
        // parameters.add(evalTask);
        try {
            parameters.addAll(Arrays.asList(URLDecoder.decode(evalTask, "UTF-8").split(" ")));
        } catch (UnsupportedEncodingException ex) {
            ex.printStackTrace();
        }
        String[] args = parameters.toArray(new String[0]);
        Option[] extraOptions = new Option[] {};
        // build a single string by concatenating cli options
        StringBuilder cliString = new StringBuilder();
        for (int i = 0; i < args.length; i++) {
            cliString.append(" ").append(args[i]);
        }

        // parse options
        try {
            task = (Task) ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions);
            task.setFactory(factory);
            task.init();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
136147
public void onServletInit (@Nonnull final Class <? extends GenericServlet> aServletClass)
  {
    if (LOGGER.isDebugEnabled ())
      LOGGER.debug ("onServletInit: " + aServletClass);
    _updateStatus (aServletClass, EServletStatus.INITED);
  }
822959
public static synchronized void init() {
        if (initialized)
            return;
        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "init");
        }

        initialized = true;
        //defaultLevel = StatConstants.STATISTIC_SET_EXTENDED;
        defaultLevel = StatConstants.STATISTIC_SET_BASIC;
        moduleRoot = new ModuleItem();
        setInstrumentationLevel(defaultLevel);
        //disabled = false;
        try {
            MBeanServer mServer = ManagementFactory.getPlatformMBeanServer();
            ObjectName pmiMBean = new ObjectName(PmiConstants.MBEAN_NAME);
            mServer.registerMBean(PmiCollaboratorFactory.getPmiCollaborator(), pmiMBean);
            printAllMBeans();
        } catch (Exception e) {
            Tr.error(tc, "Unable to create Perf MBean.");
            FFDCFilter.processException(e, "com.ibm.ws.pmi.server.PmiRegistry", "Init");
        }
        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "init");
        }
    }
479915
@Override
	public void addJvmMemberInitializer(Runnable runnable) {
		if (isInitializingJvmMembers) {
			throw new IllegalStateException("Cannot enqueue runnables during JvmMemberInitialization");
		}
		if (this.jvmMemberInitializers == null) {
			this.jvmMemberInitializers = new LinkedHashSet<Runnable>();
			this.hasJvmMemberInitializers = true;
			for (EObject obj : getContents()) {
				if (obj instanceof JvmDeclaredTypeImplCustom) {
					JvmDeclaredTypeImplCustom type = (JvmDeclaredTypeImplCustom) obj;
					markPendingInitialization(type);
				}
			}
		}
		this.jvmMemberInitializers.add(runnable);
	}
1175947
protected void startThread() {

        m_reportPanel.setVisible(true);
        m_startPanel.setVisible(false);
        Component report = m_manager.getUpdateThreadComponent(m_indexList);
        report.setHeight("500px");
        report.setWidth("100%");
        m_layout.removeAllComponents();
        m_layout.addComponent(report);
    }
703536
public void executeInIoThread(Runnable task, boolean alwaysAsync) {
        if (!alwaysAsync && isIoThread()) {
            task.run();
        } else {
            registerTask(task);
        }
    }
1240114
public void threadAccepted(IVdmThread thread, boolean first)
	{
		if (first)
		{
			DebugEventHelper.fireExtendedEvent(this, ExtendedDebugEventDetails.BEFORE_CODE_LOADED);
			initialized = true;
			fireTargetInitialized();
		}
	}
1014911
public void start() {
        switch (WORKER_STATE_UPDATER.get(this)) {
            case WORKER_STATE_INIT:
                if (WORKER_STATE_UPDATER.compareAndSet(this, WORKER_STATE_INIT, WORKER_STATE_STARTED)) {
                    workerThread.start();
                }
                break;
            case WORKER_STATE_STARTED:
                break;
            case WORKER_STATE_SHUTDOWN:
                throw new IllegalStateException("cannot be started once stopped");
            default:
                throw new Error("Invalid WorkerState");
        }

        // Wait until the startTime is initialized by the worker.
        while (startTime == 0) {
            try {
                startTimeInitialized.await();
            } catch (InterruptedException ignore) {
                // Ignore - it will be ready very soon.
            }
        }
    }
171310
public void setStartFromZero(final boolean IS_TRUE) {
        if (null == startFromZero) {
            _startFromZero = IS_TRUE;
            //setValue(IS_TRUE && getMinValue() < 0 ? 0 : getMinValue());
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            startFromZero.set(IS_TRUE);
        }
    }
991128
@Api
	public void runWhenInitialized(Runnable runnable) {
		if (isInitialized()) {
			runnable.run();
		} else {
			whenInitializedRunnables.add(runnable);
		}
	}
1008473
public static void interupt(Thread thread, boolean isJoin) {
		if (null != thread && false == thread.isInterrupted()) {
			thread.interrupt();
			if (isJoin) {
				waitForDie(thread);
			}
		}
	}
270751
private static final void setInit(final CClassLoader loader) {
		loader.booInit = true;

		for (final Iterator it = loader.getChildLoader(); it.hasNext();) {
			final Map.Entry entry = (Map.Entry) it.next();
			CClassLoader.setInit((CClassLoader) entry.getValue());
		}
	}