protected void registerMBeanAndMetrics()

in src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPoolManager.java [436:450]


        protected void registerMBeanAndMetrics() {
            try {
                final Dictionary<String, String> mbeanProps = new Hashtable<>();
                mbeanProps.put("jmx.objectname", "org.apache.sling:type=threads,service=ThreadPool,name=" + this.name);

                final ThreadPoolMBeanImpl mbean = new ThreadPoolMBeanImpl(this);
                this.mbeanRegistration = bundleContext.registerService(ThreadPoolMBean.class.getName(), mbean, mbeanProps);

                for(Map.Entry<String, Gauge<?>> nameToGauge : ThreadPoolMetricsGauges.create(mbean).entrySet()) {
                    addGauge(nameToGauge.getKey(), nameToGauge.getValue());
                }
            } catch (Exception e) {
                logger.warn("Unable to register Thread Pool MBean", e);
            }
        }