Merge "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
1 /*
2  * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.md.sal.common.util.jmx;
10
11 import java.beans.ConstructorProperties;
12
13 /**
14  * A bean class that holds various thread executor statistic metrics. This class is suitable for
15  * mapping to the MXBean CompositeDataSupport type;
16  *
17  * @author Thomas Pantelis
18  * @see ThreadExecutorStatsMXBeanImpl
19  */
20 public class ThreadExecutorStats {
21
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;
30
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;
35
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;
53     }
54
55     public long getActiveThreadCount() {
56         return activeThreadCount;
57     }
58
59     public long getCompletedTaskCount() {
60         return completedTaskCount;
61     }
62
63     public Long getRejectedTaskCount() {
64         return rejectedTaskCount;
65     }
66
67     public long getCurrentQueueSize() {
68         return currentQueueSize;
69     }
70
71     public Long getLargestQueueSize() {
72         return largestQueueSize;
73     }
74
75     public long getMaxThreadPoolSize() {
76         return maxThreadPoolSize;
77     }
78
79     public long getTotalTaskCount() {
80         return totalTaskCount;
81     }
82
83     public long getLargestThreadPoolSize() {
84         return largestThreadPoolSize;
85     }
86
87     public long getMaxQueueSize() {
88         return maxQueueSize;
89     }
90
91     public long getCurrentThreadPoolSize() {
92         return currentThreadPoolSize;
93     }
94 }