EMAdapter initializer
 Start the eventmachine reactor thread if not running
14420
def start
    @em_lock.synchronize{
      # TODO on event of the process ending this thread will be
      # shutdown before a local finalizer can be run,
      # would be good to gracefully shut this down / wait for completion
      @reactor_thread  = Thread.new {
        begin
          EventMachine.run
        rescue Exception => e
          # TODO option to autorestart the reactor on errors ?
          puts "Critical exception #{e}\n#{e.backtrace.join("\n")}"
        ensure
          @em_lock.synchronize { @reactor_thread = nil }
        end
      } unless @reactor_thread
    }
    sleep 0.01 until EventMachine.reactor_running? # XXX hack but needed
    self
  end
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();
        }

    }
813528
@Override
  final void startImpl(Optional<String> name) {
    this.executorService =
        ExecutorsUtils.loggingDecorator(Executors.newScheduledThreadPool(0,
                ExecutorsUtils.newDaemonThreadFactory(Optional.of(LOGGER), name)));
  }
1283162
@Override
    public void engineReloaded(Object messagingEngine)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "engineReloaded");

        // Defect 337421.1
        // Our config has been reloaded so we need to essentially
        // re-initialize so that the next time that we run start()
        // we pick up any changes.
        initialize((JsMessagingEngine) messagingEngine, true);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "engineReloaded");
    }
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");
        }
    }
1330587
function initAsyncResource(asyncId, type, triggerAsyncId, resource) {
	if (wakingup) {
		return;
	}
	wakingup = true;
	setImmediate(() => {
		EventLoop.wakeupBackgroundThread();
		wakingup = false;
	});
}
26407
@Override
	public void onStart() throws Exception {
		try {
			startResourceManagerServices();
		} catch (Exception e) {
			final ResourceManagerException exception = new ResourceManagerException(String.format("Could not start the ResourceManager %s", getAddress()), e);
			onFatalError(exception);
			throw exception;
		}
	}
1273203
function init(noEmitter) {
	if (!noEmitter) {
		if (emitter) apperror.removeErrorListener(emitter)
		emitter = new events.EventEmitter
		emitter.id = 'Api Manager'
		apperror.addErrorListener(emitter)
	}
	return emitter
}
177168
public synchronized final void start()
    	throws Exception
    {
        if (_started || _starting)
            return;
        
        _starting=true;
        
        if (log.isDebugEnabled()) log.debug("Starting "+this);
        LifeCycleEvent event = new LifeCycleEvent(this);
        for(int i=0;i<LazyList.size(_eventListeners);i++)
        {
            EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
            if (listener instanceof LifeCycleListener)
                ((LifeCycleListener)listener).lifeCycleStarting(event);
        }
        
        try
        {
            doStart();
            _started=true;
            log.info("Started "+this);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof LifeCycleListener)
                    ((LifeCycleListener)listener).lifeCycleStarted(event);
            }
        }
        catch(Throwable e)
        {
            LifeCycleEvent failed = new LifeCycleEvent(this,e);
            for(int i=0;i<LazyList.size(_eventListeners);i++)
            {
                EventListener listener=(EventListener)LazyList.get(_eventListeners,i);
                if (listener instanceof LifeCycleListener)
                    ((LifeCycleListener)listener).lifeCycleFailure(event);
            }
            if (e instanceof Exception)
                throw (Exception)e;
            if (e instanceof RuntimeException)
                throw (RuntimeException)e;
            if (e instanceof Error)
                throw (Error)e;
            log.warn(LogSupport.EXCEPTION, e);
        }
        finally
        {
            _starting=false;
        }
    }
583982
void start() throws IOException, TooManyListenersException {
        inputStream = port.getInputStream();
        outputStream = port.getOutputStream();
        ReadWorker w = new ReadWorker();
        w.start();
        port.addEventListener(this);
        service.getIdleStatusChecker0().addSession(this);
        try {
            getService().getFilterChainBuilder().buildFilterChain(getFilterChain());
            serviceListeners.fireSessionCreated(this);
        } catch (Throwable e) {
            getFilterChain().fireExceptionCaught(e);
            processor.remove(this);
        }
    }
909449
public static void initialise(AcceptListenerFactory _acceptListenerFactory)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "initialise");

        if (!initialised)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "not previously initialised");
            Class clientImpl = instance.getClass();
            Method initialiseMethod;
            try
            {
                initialiseMethod = clientImpl.getMethod("initialise", new Class[] { AcceptListenerFactory.class });
                initialiseMethod.invoke(clientImpl, new Object[] { _acceptListenerFactory });
            } catch (Exception e)
            {
                FFDCFilter.processException
                                (e, "com.ibm.ws.sib.jfapchannel.ServerConnectionManager.{}",
                                 JFapChannelConstants.SRVRCONNMGR_INITIALISE_01);

                // Start D249068.1
                // Ensure the exception we dump to the user is the root exception if it was an
                // InvocationTargetException
                Throwable displayedException = e;
                if (e instanceof InvocationTargetException)
                    displayedException = e.getCause();

                SibTr.error(tc, "EXCP_DURING_INIT_SICJ0003", new Object[] { clientImpl, displayedException });
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.exception(tc, e);
                // End D249068.1
            }
            initialised = true;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "initialise");
    }
91983
@SuppressWarnings("unchecked")
    @PostConstruct
    void init(BeanContext beanContext, ThreadFactory threadFactory) {
        try {
            BeanDefinition<ExecutorService> beanDefinition = beanContext.getBeanDefinition(ExecutorService.class, Qualifiers.byName(TaskExecutors.SCHEDULED));
            Collection<BeanCreatedEventListener> schedulerCreateListeners =
                    beanContext.getBeansOfType(BeanCreatedEventListener.class, Qualifiers.byTypeArguments(ScheduledExecutorService.class));

            Schedulers.addExecutorServiceDecorator(Environment.MICRONAUT, (scheduler, scheduledExecutorService) -> {
                for (BeanCreatedEventListener schedulerCreateListener : schedulerCreateListeners) {
                    Object newBean = schedulerCreateListener.onCreated(new BeanCreatedEvent(beanContext, beanDefinition, BeanIdentifier.of("reactor-" + scheduler.getClass().getSimpleName()), scheduledExecutorService));
                    if (!(newBean instanceof ScheduledExecutorService)) {
                        throw new BeanContextException("Bean creation listener [" + schedulerCreateListener + "] should return ScheduledExecutorService, but returned " + newBean);
                    }
                    scheduledExecutorService = (ScheduledExecutorService) newBean;
                }
                return scheduledExecutorService;
            });
        } catch (Exception e) {
            if (LOG.isErrorEnabled()) {
                LOG.error("Could not instrument Reactor for Tracing: " + e.getMessage(), e);
            }
        }
    }
610878
@SneakyThrows
    @SuppressWarnings("FutureReturnValueIgnored")
    public void init() {
        if (!validateConfiguration()) {
            return;
        }

        val results = this.fetcher.fetch(getResources());
        ResourceCRLRevocationChecker.this.addCrls(results);

        final Runnable scheduledFetcher = () -> {
            try {
                val fetchedResults = getFetcher().fetch(getResources());
                ResourceCRLRevocationChecker.this.addCrls(fetchedResults);
            } catch (final Exception e) {
                LOGGER.debug(e.getMessage(), e);
            }
        };

        this.scheduler.scheduleAtFixedRate(
            scheduledFetcher,
            this.refreshInterval,
            this.refreshInterval,
            TimeUnit.SECONDS);

    }
755263
@SuppressWarnings("rawtypes")
    @Override
    public void open(Map conf, TopologyContext context, SpoutOutputCollector collector)
    {
        super.open(conf, context, collector);

        this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId();

        if (this.reloadConfig)
        {
            if (conf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY))
            {
                String watchPath = conf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString();
                String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}";
                logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec));

                this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec);
                this.watcher.init();
            }
        }

        onOpen(conf, context);
    }
1295440
private void startHandleModifyThread(final WatchEvent<?> event, final Path currentPath) {
		ThreadUtil.execute(new Runnable(){
			@Override
			public void run() {
				ThreadUtil.sleep(delay);
				eventSet.remove(Paths.get(currentPath.toString(), event.context().toString()));
				watcher.onModify(event, currentPath);
			}
		});
	}
78563
protected void initConfig() {
        CollectorConfiguration config = configurationService.getCollector(null, null, null, null);

        if (config != null) {
            configLastUpdated = System.currentTimeMillis();

            filterManager = new FilterManager(config);
            try {
                processorManager = new ProcessorManager(config);
            } catch (Throwable t) {
                if (t != null) {
                    log.log(Level.SEVERE, "Failed to initialise Process Manager", t);
                }
            }

            initRefreshCycle();
        } else {
            // Wait for a period of time and try doing the initial config again
            Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
                public Thread newThread(Runnable r) {
                    Thread t = Executors.defaultThreadFactory().newThread(r);
                    t.setDaemon(true);
                    return t;
                }
            }).schedule(new Runnable() {
                @Override
                public void run() {
                    initConfig();
                }
            }, configRetryInterval, TimeUnit.SECONDS);
        }
    }
181836
public void start() throws Throwable
   {
      Context context = null;
      try
      {
         Properties properties = new Properties();
         properties.setProperty(Context.PROVIDER_URL, jndiProtocol + "://" + jndiHost + ":" + jndiPort);
         context = new InitialContext(properties);
         context.rebind(VALIDATOR_FACTORY, new SerializableValidatorFactory(validatorFactory));
      }
      finally
      {
         try
         {
            if (context != null)
               context.close();
         }
         catch (NamingException ne)
         {
            // Ignore
         }
      }
   }