Integrate MRI projects for Neon
[controller.git] / opendaylight / md-sal / sal-common-util / src / main / java / org / opendaylight / controller / md / sal / common / util / jmx / ThreadExecutorStatsMXBeanImpl.java
index c6738c77cea34d061796b2ba4863179abcc9dcd2..47a0cc84ccf4db96b97b04c30f49d95003e43ec9 100644 (file)
@@ -76,6 +76,20 @@ public class ThreadExecutorStatsMXBeanImpl extends AbstractMXBean
         return ret;
     }
 
+    /**
+     * Creates a new bean if the backing executor is a ThreadPoolExecutor and registers it.
+     *
+     * @param executor the backing {@link Executor}
+     * @param beanName Used as the <code>name</code> property in the bean's ObjectName.
+     * @param beanType Used as the <code>type</code> property in the bean's ObjectName.
+     * @return a registered ThreadExecutorStatsMXBeanImpl instance if the backing executor
+     *         is a ThreadPoolExecutor, otherwise null.
+     */
+    public static ThreadExecutorStatsMXBeanImpl create(final Executor executor, final String beanName,
+            final String beanType) {
+        return create(executor, beanName, beanType, null);
+    }
+
     /**
      * Creates a new bean if the backing executor is a ThreadPoolExecutor.
      *