Skip to content

Commit

Permalink
Add an outgoing batch stat to the JMX bean
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 15, 2008
1 parent 5fc4c81 commit 16bf33e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Expand Up @@ -19,9 +19,30 @@
*/
package org.jumpmind.symmetric.service.jmx;

import java.math.BigDecimal;

import org.jumpmind.symmetric.statistic.IStatisticManager;
import org.jumpmind.symmetric.statistic.StatisticName;
import org.springframework.jmx.export.annotation.ManagedAttribute;
import org.springframework.jmx.export.annotation.ManagedResource;

@ManagedResource(description = "The management interface for outgoing synchronization")
public class OutgoingManagementService {

IStatisticManager statisticManager;

public void setStatisticManager(IStatisticManager statisticManager) {
this.statisticManager = statisticManager;
}

@ManagedAttribute(description = "Get the average number of events in each batch since the last statistic flush")
public BigDecimal getPeriodicAverageEventsPerBatch() {
return this.statisticManager.getStatistic(StatisticName.OUTGOING_EVENTS_PER_BATCH).getAverageValue();
}

@ManagedAttribute(description = "Get the average number of events in each batch for the lifetime of the server")
public BigDecimal getServerLifetimeAverageEventsPerBatch() {
return this.statisticManager.getStatistic(StatisticName.OUTGOING_EVENTS_PER_BATCH)
.getLifetimeAverageValue();
}
}
4 changes: 3 additions & 1 deletion symmetric/src/main/resources/symmetric-jmx.xml
Expand Up @@ -70,7 +70,9 @@
<property name="statisticManager" ref="statisticManager" />
</bean>

<bean id="outgoingManagementService" class="org.jumpmind.symmetric.service.jmx.OutgoingManagementService" />
<bean id="outgoingManagementService" class="org.jumpmind.symmetric.service.jmx.OutgoingManagementService">
<property name="statisticManager" ref="statisticManager" />
</bean>

<bean id="parameterManagementService" class="org.jumpmind.symmetric.service.jmx.ParameterManagementService">
<property name="parameterService" ref="parameterService" />
Expand Down

0 comments on commit 16bf33e

Please sign in to comment.