Bug 1446: Add JMX stats for in-memory data store
[controller.git] / opendaylight / md-sal / sal-common-util / src / main / java / org / opendaylight / controller / md / sal / common / util / jmx / ThreadExecutorStats.java
diff --git a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/ThreadExecutorStats.java b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/ThreadExecutorStats.java
new file mode 100644 (file)
index 0000000..0a766c0
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.sal.common.util.jmx;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * A bean class that holds various thread executor statistic metrics. This class is suitable for
+ * mapping to the MXBean CompositeDataSupport type;
+ *
+ * @author Thomas Pantelis
+ * @see ThreadExecutorStatsMXBeanImpl
+ */
+public class ThreadExecutorStats {
+
+    private final long activeThreadCount;
+    private final long completedTaskCount;
+    private final long currentQueueSize;
+    private final long maxThreadPoolSize;
+    private final long totalTaskCount;
+    private final long largestThreadPoolSize;
+    private final long maxQueueSize;
+    private final long currentThreadPoolSize;
+
+    // The following fields are defined as Long because they may be null if we can't a value
+    // from the underlying executor.
+    private final Long largestQueueSize;
+    private final Long rejectedTaskCount;
+
+    @ConstructorProperties({"activeThreadCount","currentThreadPoolSize","largestThreadPoolSize",
+        "maxThreadPoolSize","currentQueueSize","largestQueueSize","maxQueueSize",
+        "completedTaskCount","totalTaskCount","rejectedTaskCount"})
+    public ThreadExecutorStats(long activeThreadCount, long currentThreadPoolSize,
+            long largestThreadPoolSize, long maxThreadPoolSize, long currentQueueSize,
+            Long largestQueueSize, long maxQueueSize, long completedTaskCount,
+            long totalTaskCount, Long rejectedTaskCount) {
+        this.activeThreadCount = activeThreadCount;
+        this.currentThreadPoolSize = currentThreadPoolSize;
+        this.largestQueueSize = largestQueueSize;
+        this.largestThreadPoolSize = largestThreadPoolSize;
+        this.maxThreadPoolSize = maxThreadPoolSize;
+        this.currentQueueSize = currentQueueSize;
+        this.maxQueueSize = maxQueueSize;
+        this.completedTaskCount = completedTaskCount;
+        this.totalTaskCount = totalTaskCount;
+        this.rejectedTaskCount = rejectedTaskCount;
+    }
+
+    public long getActiveThreadCount() {
+        return activeThreadCount;
+    }
+
+    public long getCompletedTaskCount() {
+        return completedTaskCount;
+    }
+
+    public Long getRejectedTaskCount() {
+        return rejectedTaskCount;
+    }
+
+    public long getCurrentQueueSize() {
+        return currentQueueSize;
+    }
+
+    public Long getLargestQueueSize() {
+        return largestQueueSize;
+    }
+
+    public long getMaxThreadPoolSize() {
+        return maxThreadPoolSize;
+    }
+
+    public long getTotalTaskCount() {
+        return totalTaskCount;
+    }
+
+    public long getLargestThreadPoolSize() {
+        return largestThreadPoolSize;
+    }
+
+    public long getMaxQueueSize() {
+        return maxQueueSize;
+    }
+
+    public long getCurrentThreadPoolSize() {
+        return currentThreadPoolSize;
+    }
+}
\ No newline at end of file