Create the initial {@link PerformanceMonitorBean} instances.
960204
public void createInitialPerformanceMonitors() {
        if (packageScanBase != null) {
            AnnotatedMethodScanner methodScanner = new AnnotatedMethodScanner();
            for (Method m : methodScanner.findAnnotatedMethods(packageScanBase, org.fishwife.jrugged.aspects.PerformanceMonitor.class)) {
                org.fishwife.jrugged.aspects.PerformanceMonitor performanceMonitorAnnotation = m.getAnnotation(org.fishwife.jrugged.aspects.PerformanceMonitor.class);
                initialPerformanceMonitorList.add(performanceMonitorAnnotation.value());
            }
        }
        for (String name: initialPerformanceMonitorList) {
            createPerformanceMonitor(name);
        }
    }
359435
protected void startJvmMonitorProcess() {
    if (ServerConfiguration.getBoolean(PropertyKey.MASTER_JVM_MONITOR_ENABLED)) {
      mJvmPauseMonitor = new JvmPauseMonitor(
          ServerConfiguration.getMs(PropertyKey.JVM_MONITOR_SLEEP_INTERVAL_MS),
          ServerConfiguration.getMs(PropertyKey.JVM_MONITOR_INFO_THRESHOLD_MS),
          ServerConfiguration.getMs(PropertyKey.JVM_MONITOR_WARN_THRESHOLD_MS));
      mJvmPauseMonitor.start();
    }
  }
1365594
async def init(self) -> None:
        ''''''

        self.stats = await self.insert(self.stats)
        self.configuration = await self.insert(self.configuration)

        if not self.executor:
            try:
                max_workers = self.config.get('executor_workers')
            except Exception:
                max_workers = None

            self.executor = ThreadPoolExecutor(max_workers=max_workers)

        for task in self.initial_tasks:
            await self.insert(task)

        self.monitor = asyncio.ensure_future(self.monitor_tasks())
        self.counters['alive_since'] = time.time()
1316693
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException {

		if (beanFactory == null) {
			return;
		}

		String[] beanNames = beanFactory.getBeanDefinitionNames();
		int singletonBeanCount = 0;

		for (int i = 0; i < beanNames.length; i++) {
			// using beanDefinition to check singleton property because when
			// accessing through
			// context (applicationContext.isSingleton(beanName)), bean will be
			// created already,
			// possibly bypassing other BeanFactoryPostProcessors
			BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanNames[i]);

			if (beanDefinition.isSingleton()) {
				singletonBeanCount++;
			}

		}

		this.progressMonitor.taskStarted(this.loadingAppContextMessage, singletonBeanCount);

		beanFactory.addBeanPostProcessor(new ProgressMonitoringBeanPostProcessor(beanFactory));

	}
1264763
private void initMapper() {
        final BeanPropertyFilter filterOutAllExcept =
                SimpleBeanPropertyFilter.filterOutAllExcept("fname", "executionTimeNano");
        this.mapper.addMixInAnnotations(
                PortalEvent.class, PortletRenderExecutionEventFilterMixIn.class);
        final SimpleFilterProvider filterProvider = new SimpleFilterProvider();
        filterProvider.addFilter(
                PortletRenderExecutionEventFilterMixIn.FILTER_NAME, filterOutAllExcept);
        this.portletEventWriter = this.mapper.writer(filterProvider);
    }
77072
static void init() {
		initialContextFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
		System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
				MonitoringInitialContextFactory.class.getName());
	}
1119526
private ExecutorService _createExecutorService() {
        int producerConnections = Math.max(Integer.valueOf(
            _configuration.getValue(Property.KAFKA_PRODUCER_CONNECTIONS.getName(), Property.KAFKA_PRODUCER_CONNECTIONS.getDefaultValue())), 10);

        return Executors.newFixedThreadPool(producerConnections, new ThreadFactory() {

                AtomicInteger id = new AtomicInteger(0);

                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, MessageFormat.format("kafka-producer-worker-{0}", id.getAndIncrement()));
                }
            });
    }
885925
public void startReporting() {

        if (executorService == null) {
            throw new IllegalStateException("MonitoringServiceClient already shutdown");
        }

        if (scheduledFuture != null) {
            logger.error("only one performance reporting thread can be started");
            return;
        }

        Runnable performanceReporterCallable = new Runnable() {

            @Override
            public void run() {
                try {

                    // only send a report if the bounce proxy is initialized
                    if (bounceProxyLifecycleMonitor.isInitialized()) {

                        // Don't do any retries here. If we miss on performance
                        // report, we'll just wait for the next loop.
                        sendPerformanceReportAsHttpRequest();
                    }

                } catch (Exception e) {
                    logger.error("Uncaught exception in reportPerformance.", e);
                }
            }

        };

        scheduledFuture = executorService.scheduleWithFixedDelay(performanceReporterCallable,
                                                                 performanceReportingFrequencyMs,
                                                                 performanceReportingFrequencyMs,
                                                                 TimeUnit.MILLISECONDS);
    }
48249
private synchronized void initialize() {

    if (this.runtimes != null) {
      return;
    }

    this.runtimes = new HashMap<>();

    for (final AvroRuntimeDefinition rd : runtimeDefinition.getRuntimes()) {
      try {

        // We need to create different injector for each runtime as they define conflicting bindings. Also we cannot
        // fork the original injector because of the same reason.
        // We create new injectors and copy form the original injector what we need.
        // rootInjector is an emptyInjector that we copy bindings from the original injector into. Then we fork
        // it to instantiate the actual runtime.
        final Injector rootInjector = Tang.Factory.getTang().newInjector();
        initializeInjector(rootInjector);

        final Configuration runtimeConfig =
            Tang.Factory.getTang().newConfigurationBuilder()
                .bindNamedParameter(RuntimeName.class, rd.getRuntimeName().toString())
                .bindImplementation(Runtime.class, RuntimeImpl.class)
                .build();

        final Configuration config =
            new AvroConfigurationSerializer().fromString(rd.getSerializedConfiguration().toString());

        final Injector runtimeInjector = rootInjector.forkInjector(config, runtimeConfig);

        this.runtimes.put(rd.getRuntimeName().toString(), runtimeInjector.getInstance(Runtime.class));

      } catch (final IOException | InjectionException e) {
        throw new RuntimeException("Unable to initialize runtimes.", e);
      }
    }
  }
987782
public AbstractCounterFactory init() {
        int numProcessors = Runtime.getRuntime().availableProcessors();
        counterCache = CacheBuilder.newBuilder().concurrencyLevel(Math.max(numProcessors, 8))
                .expireAfterAccess(3600, TimeUnit.SECONDS)
                .removalListener(new RemovalListener<String, ICounter>() {
                    @Override
                    public void onRemoval(RemovalNotification<String, ICounter> notification) {
                        ICounter counter = notification.getValue();
                        destroyCounter(counter);
                    }
                }).build(new CacheLoader<String, ICounter>() {
                    @Override
                    public ICounter load(String key) throws Exception {
                        return createCounter(key);
                    }
                });
        return this;
    }
548993
def ClientInit():
  """"""
  metric_metadata = client_metrics.GetMetadata()
  metric_metadata.extend(communicator.GetMetricMetadata())
  stats_collector_instance.Set(
      default_stats_collector.DefaultStatsCollector(metric_metadata))

  config_lib.SetPlatformArchContext()
  config_lib.ParseConfigCommandLine()

  client_logging.LogInit()
  all_parsers.Register()
  registry.Init()

  if not config.CONFIG.ContextApplied(contexts.CLIENT_BUILD_CONTEXT):
    config.CONFIG.Persist("Client.labels")
    config.CONFIG.Persist("Client.proxy_servers")
    config.CONFIG.Persist("Client.tempdir_roots")
1155721
@PostConstruct
    public void init() {
        this.metricRegistry.register(name("gc"), new GarbageCollectorMetricSet());
        this.metricRegistry.register(name("memory"), new MemoryUsageGaugeSet());
        this.metricRegistry.register(name("thread-states"), new ThreadStatesGaugeSet());
        this.metricRegistry.register(name("fd-usage"), new FileDescriptorRatioGauge());
    }
1134235
public synchronized static void init() {
    if (!isInitialized()) {
      if (processEngines == null) {
        // Create new map to store process-engines if current map is
        // null
        processEngines = new HashMap<String, ProcessEngine>();
      }
      ClassLoader classLoader = ReflectUtil.getClassLoader();
      Enumeration<URL> resources = null;
      try {
        resources = classLoader.getResources("activiti.cfg.xml");
      } catch (IOException e) {
        throw new ActivitiIllegalArgumentException("problem retrieving activiti.cfg.xml resources on the classpath: " + System.getProperty("java.class.path"), e);
      }

      // Remove duplicated configuration URL's using set. Some
      // classloaders may return identical URL's twice, causing duplicate
      // startups
      Set<URL> configUrls = new HashSet<URL>();
      while (resources.hasMoreElements()) {
        configUrls.add(resources.nextElement());
      }
      for (Iterator<URL> iterator = configUrls.iterator(); iterator.hasNext();) {
        URL resource = iterator.next();
        log.info("Initializing process engine using configuration '{}'", resource.toString());
        initProcessEngineFromResource(resource);
      }

      try {
        resources = classLoader.getResources("activiti-context.xml");
      } catch (IOException e) {
        throw new ActivitiIllegalArgumentException("problem retrieving activiti-context.xml resources on the classpath: " + System.getProperty("java.class.path"), e);
      }
      while (resources.hasMoreElements()) {
        URL resource = resources.nextElement();
        log.info("Initializing process engine using Spring configuration '{}'", resource.toString());
        initProcessEngineFromSpringResource(resource);
      }

      setInitialized(true);
    } else {
      log.info("Process engines already initialized");
    }
  }
295145
protected void initOutputs() throws Exception {
		this.chainedTasks = new ArrayList<ChainedDriver<?, ?>>();
		this.eventualOutputs = new ArrayList<RecordWriter<?>>();

		ClassLoader userCodeClassLoader = getUserCodeClassLoader();

		this.accumulatorMap = getEnvironment().getAccumulatorRegistry().getUserMap();

		this.output = initOutputs(this, userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs,
				this.getExecutionConfig(), this.accumulatorMap);
	}
570653
@Setup
    public void setUp() throws Exception {
        ClassByImplementationBenchmark classByImplementationBenchmark = new ClassByImplementationBenchmark();
        baselineInstance = classByImplementationBenchmark.baseline();
        byteBuddyInstance = classByImplementationBenchmark.benchmarkByteBuddy();
        cglibInstance = classByImplementationBenchmark.benchmarkCglib();
        javassistInstance = classByImplementationBenchmark.benchmarkJavassist();
        jdkProxyInstance = classByImplementationBenchmark.benchmarkJdkProxy();
    }
1070012
@Override
    public void doSessionCreated(SessionManagementBean sessionBean) throws Exception {
        SessionMXBean sessionMxBean = managementServiceHandler.getSessionMXBean(sessionBean.getId());

        Map<String, String> userPrincipals = sessionBean.getUserPrincipalMap();

        // Send a notification for the principals for the logged-in session.
        if (userPrincipals != null) {
            Map<String, Map<String, String>> userData = new HashMap<>();
            userData.put(sessionMxBean.getObjectName().toString(), userPrincipals);

            Notification n2 = new Notification(SESSION_CREATED,
                    sessionMxBean,
                    managementServiceHandler.nextNotificationSequenceNumber(),
                    System.currentTimeMillis(),
                    "Session Credentials Registered");
            n2.setUserData(userData);
            sendNotification(n2);
        }
    }
333936
@Override
	public DynamicMBean createFor(List<?> monitorables, MBeanSettings setting, boolean enableRefresh) {
		checkNotNull(monitorables);
		checkArgument(monitorables.size() > 0, "Size of list of monitorables should be greater than 0");
		checkArgument(monitorables.stream().noneMatch(Objects::isNull), "Monitorable can not be null");
		checkArgument(CollectionUtils.allItemsHaveSameType(monitorables), "Monitorables should be of the same type");

		Object firstMBean = monitorables.get(0);
		Class<?> mbeanClass = firstMBean.getClass();

		boolean isRefreshEnabled = enableRefresh;

		List<MBeanWrapper> mbeanWrappers = new ArrayList<>(monitorables.size());
		if (ConcurrentJmxMBean.class.isAssignableFrom(mbeanClass)) {
			checkArgument(monitorables.size() == 1, "ConcurrentJmxMBeans cannot be used in pool. " +
					"Only EventloopJmxMBeans can be used in pool");
			isRefreshEnabled = false;
			mbeanWrappers.add(new ConcurrentJmxMBeanWrapper((ConcurrentJmxMBean) monitorables.get(0)));
		} else if (EventloopJmxMBean.class.isAssignableFrom(mbeanClass)) {
			for (Object monitorable : monitorables) {
				mbeanWrappers.add(new EventloopJmxMBeanWrapper((EventloopJmxMBean) monitorable));
			}
		} else {
			throw new IllegalArgumentException("MBeans should implement either ConcurrentJmxMBean " +
					"or EventloopJmxMBean interface");
		}

		AttributeNodeForPojo rootNode = createAttributesTree(mbeanClass, setting.getCustomTypes());
		rootNode.hideNullPojos(monitorables);

		for (String included : setting.getIncludedOptionals()) {
			rootNode.setVisible(included);
		}

		// TODO(vmykhalko): check in JmxRegistry that modifiers are applied only once in case of workers and pool registartion
		for (String attrName : setting.getModifiers().keySet()) {
			AttributeModifier<?> modifier = setting.getModifiers().get(attrName);
			try {
				rootNode.applyModifier(attrName, modifier, monitorables);
			} catch (ClassCastException e) {
				//noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException - doesn't ignore
				throw new IllegalArgumentException("Cannot apply modifier \"" + modifier.getClass().getName() +
						"\" for attribute \"" + attrName + "\": " + e.toString());
			}
		}

		MBeanInfo mBeanInfo = createMBeanInfo(rootNode, mbeanClass);
		Map<OperationKey, Method> opkeyToMethod = fetchOpkeyToMethod(mbeanClass);

		DynamicMBeanAggregator mbean = new DynamicMBeanAggregator(mBeanInfo, mbeanWrappers, rootNode, opkeyToMethod);

		// TODO(vmykhalko): maybe try to get all attributes and log warn message in case of exception? (to prevent potential errors during viewing jmx stats using jconsole)
//		tryGetAllAttributes(mbean);

		if (isRefreshEnabled) {
			handleJmxRefreshables(mbeanWrappers, rootNode);
		}
		return mbean;
	}