2 * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.md.sal.common.util.jmx;
11 import java.beans.ConstructorProperties;
14 * A bean class that holds various thread executor statistic metrics. This class is suitable for
15 * mapping to the MXBean CompositeDataSupport type;
17 * @author Thomas Pantelis
18 * @see ThreadExecutorStatsMXBeanImpl
20 public class ThreadExecutorStats {
22 private final long activeThreadCount;
23 private final long completedTaskCount;
24 private final long currentQueueSize;
25 private final long maxThreadPoolSize;
26 private final long totalTaskCount;
27 private final long largestThreadPoolSize;
28 private final long maxQueueSize;
29 private final long currentThreadPoolSize;
31 // The following fields are defined as Long because they may be null if we can't a value
32 // from the underlying executor.
33 private final Long largestQueueSize;
34 private final Long rejectedTaskCount;
36 @ConstructorProperties({"activeThreadCount","currentThreadPoolSize","largestThreadPoolSize",
37 "maxThreadPoolSize","currentQueueSize","largestQueueSize","maxQueueSize",
38 "completedTaskCount","totalTaskCount","rejectedTaskCount"})
39 public ThreadExecutorStats(long activeThreadCount, long currentThreadPoolSize,
40 long largestThreadPoolSize, long maxThreadPoolSize, long currentQueueSize,
41 Long largestQueueSize, long maxQueueSize, long completedTaskCount,
42 long totalTaskCount, Long rejectedTaskCount) {
43 this.activeThreadCount = activeThreadCount;
44 this.currentThreadPoolSize = currentThreadPoolSize;
45 this.largestQueueSize = largestQueueSize;
46 this.largestThreadPoolSize = largestThreadPoolSize;
47 this.maxThreadPoolSize = maxThreadPoolSize;
48 this.currentQueueSize = currentQueueSize;
49 this.maxQueueSize = maxQueueSize;
50 this.completedTaskCount = completedTaskCount;
51 this.totalTaskCount = totalTaskCount;
52 this.rejectedTaskCount = rejectedTaskCount;
55 public long getActiveThreadCount() {
56 return activeThreadCount;
59 public long getCompletedTaskCount() {
60 return completedTaskCount;
63 public Long getRejectedTaskCount() {
64 return rejectedTaskCount;
67 public long getCurrentQueueSize() {
68 return currentQueueSize;
71 public Long getLargestQueueSize() {
72 return largestQueueSize;
75 public long getMaxThreadPoolSize() {
76 return maxThreadPoolSize;
79 public long getTotalTaskCount() {
80 return totalTaskCount;
83 public long getLargestThreadPoolSize() {
84 return largestThreadPoolSize;
87 public long getMaxQueueSize() {
91 public long getCurrentThreadPoolSize() {
92 return currentThreadPoolSize;