Merge "Serialization/Deserialization and a host of other fixes"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / jmx / mbeans / shard / ShardStats.java
1 package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
2
3 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.AbstractBaseMBean;
4
5 /**
6  * @author: syedbahm
7  */
8 public class ShardStats extends AbstractBaseMBean implements ShardStatsMBean {
9   private  Long committedTransactionsCount;
10   private Long journalMessagesCount;
11   final private String shardName;
12
13   ShardStats(String shardName){
14     this.shardName = shardName;
15     committedTransactionsCount =0L;
16     journalMessagesCount = 0L;
17   };
18
19
20   @Override
21   public String getShardName() {
22     return shardName;
23   }
24
25   @Override
26   public Long getCommittedTransactionsCount() {
27     return committedTransactionsCount;
28   }
29
30   @Override
31   public Long getJournalMessagesCount() {
32     //FIXME: this will be populated once after integration with Raft stuff
33     return journalMessagesCount;
34   }
35
36
37   public Long incrementCommittedTransactionCount() {
38     return committedTransactionsCount++;
39   }
40
41
42   public void updateCommittedTransactionsCount(long currentCount){
43      committedTransactionsCount = currentCount;
44
45   }
46
47   public void updateJournalMessagesCount(long currentCount){
48     journalMessagesCount  = currentCount;
49
50   }
51
52
53
54   @Override
55   protected String getMBeanName() {
56     return  shardName;
57   }
58
59   @Override
60   protected String getMBeanType() {
61     return JMX_TYPE_DISTRIBUTED_DATASTORE;
62   }
63
64   @Override
65   protected String getMBeanCategory() {
66     return JMX_CATEGORY_SHARD;
67   }
68
69
70 }