View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  package org.jumpmind.symmetric.service.jmx;
21  
22  import java.math.BigDecimal;
23  
24  import org.jumpmind.symmetric.statistic.IStatisticManager;
25  import org.jumpmind.symmetric.statistic.StatisticName;
26  import org.springframework.jmx.export.annotation.ManagedAttribute;
27  import org.springframework.jmx.export.annotation.ManagedResource;
28  
29  @ManagedResource(description = "The management interface for incoming synchronization")
30  public class IncomingManagementService {
31  
32      IStatisticManager statisticManager;
33  
34      public void setStatisticManager(IStatisticManager statisticManager) {
35          this.statisticManager = statisticManager;
36      }
37  
38      @ManagedAttribute(description = "Get the number of milliseconds the system is currently taking to commit a data row coming in from another node since the last time statistics were flushed")
39      public BigDecimal getPeriodicDatabaseMsPerRow() {
40          return this.statisticManager.getStatistic(StatisticName.INCOMING_MS_PER_ROW).getAverageValue();
41      }
42  
43      @ManagedAttribute(description = "Get the number of milliseconds the system is currently taking to commit a data row coming in from another node for the lifetime of the server")
44      public BigDecimal getServerLifetimeDatabaseMsPerRow() {
45          return this.statisticManager.getStatistic(StatisticName.INCOMING_MS_PER_ROW).getLifetimeAverageValue();
46      }
47  
48      @ManagedAttribute(description = "Get the number of errors that occurred during transport since the last flush")
49      public BigDecimal getPeriodicTransportErrorCount() {
50          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_ERROR_COUNT).getTotal();
51      }
52  
53      @ManagedAttribute(description = "Get the number of errors that occurred during transport for the lifetime of the server")
54      public BigDecimal getServerLifetimeTransportErrorCount() {
55          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_ERROR_COUNT).getLifetimeTotal();
56      }
57  
58      @ManagedAttribute(description = "Get the number of errors that occurred while attempting to connect to transport since the last flush")
59      public BigDecimal getPeriodicTransportConnectErrorCount() {
60          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_CONNECT_ERROR_COUNT).getTotal();
61      }
62  
63      @ManagedAttribute(description = "Get the number of errors that occurred while attempting to connect to transport for the lifetime of the server")
64      public BigDecimal getServerLifetimeTransportConnectErrorCount() {
65          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_CONNECT_ERROR_COUNT)
66                  .getLifetimeTotal();
67      }
68  
69      @ManagedAttribute(description = "Get the number of rejections that occurred while attempting to connect to transport since the last flush")
70      public BigDecimal getPeriodicTransportRejectedCount() {
71          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_REJECTED_COUNT).getTotal();
72      }
73  
74      @ManagedAttribute(description = "Get the number of rejections that occurred while attempting to connect to transport for the lifetime of the server")
75      public BigDecimal getServerLifetimeTransportRejectedCount() {
76          return this.statisticManager.getStatistic(StatisticName.INCOMING_TRANSPORT_REJECTED_COUNT).getLifetimeTotal();
77      }
78  
79      @ManagedAttribute(description = "Get the number of errors that occurred during database activity since the last flush")
80      public BigDecimal getPeriodicDatabaseErrorCount() {
81          return this.statisticManager.getStatistic(StatisticName.INCOMING_DATABASE_ERROR_COUNT).getTotal();
82      }
83  
84      @ManagedAttribute(description = "Get the number of errors that occurred during database activity for the lifetime of the server")
85      public BigDecimal getServerLifetimeDatabaseErrorCount() {
86          return this.statisticManager.getStatistic(StatisticName.INCOMING_DATABASE_ERROR_COUNT).getLifetimeTotal();
87      }
88  
89      @ManagedAttribute(description = "Get the number of unanticipated errors that occurred since the last flush")
90      public BigDecimal getPeriodicOtherErrorCount() {
91          return this.statisticManager.getStatistic(StatisticName.INCOMING_OTHER_ERROR_COUNT).getTotal();
92      }
93  
94      @ManagedAttribute(description = "Get the number of unanticipated errors that occurred for the lifetime of the server")
95      public BigDecimal getServerLifetimeOtherErrorCount() {
96          return this.statisticManager.getStatistic(StatisticName.INCOMING_OTHER_ERROR_COUNT).getLifetimeTotal();
97      }
98  
99      @ManagedAttribute(description = "Get the number of batches that have been processed since the last flush")
100     public BigDecimal getPeriodicBatchCount() {
101         return this.statisticManager.getStatistic(StatisticName.INCOMING_BATCH_COUNT).getTotal();
102     }
103 
104     @ManagedAttribute(description = "Get the number of batches that have been processed for the lifetime of the server")
105     public BigDecimal getServerLifetimeBatchCount() {
106         return this.statisticManager.getStatistic(StatisticName.INCOMING_BATCH_COUNT).getLifetimeTotal();
107     }
108 
109     @ManagedAttribute(description = "Get the number of batches that have been skipped since the last flush")
110     public BigDecimal getPeriodicSkipBatchCount() {
111         return this.statisticManager.getStatistic(StatisticName.INCOMING_SKIP_BATCH_COUNT).getTotal();
112     }
113 
114     @ManagedAttribute(description = "Get the number of batches that have been skipped for the lifetime of the server")
115     public BigDecimal getServerLifetimeSkipBatchCount() {
116         return this.statisticManager.getStatistic(StatisticName.INCOMING_SKIP_BATCH_COUNT).getLifetimeTotal();
117     }
118 
119 }