mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@697937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b6115cf660
commit
3c6805183d
|
@ -21,6 +21,7 @@ import org.apache.activemq.management.CountStatisticImpl;
|
|||
import org.apache.activemq.management.PollCountStatisticImpl;
|
||||
import org.apache.activemq.management.StatsImpl;
|
||||
import org.apache.activemq.management.TimeStatisticImpl;
|
||||
import org.apache.tools.ant.taskdefs.condition.IsReference;
|
||||
|
||||
/**
|
||||
* The J2EE Statistics for the a Destination.
|
||||
|
@ -46,7 +47,9 @@ public class DestinationStatistics extends StatsImpl {
|
|||
dequeues = new CountStatisticImpl("dequeues", "The number of messages that have been acknowledged from the destination");
|
||||
inflight = new CountStatisticImpl("inflight", "The number of messages dispatched but awaiting acknowledgement");
|
||||
consumers = new CountStatisticImpl("consumers", "The number of consumers that that are subscribing to messages from the destination");
|
||||
consumers.setDoReset(false);
|
||||
producers = new CountStatisticImpl("producers", "The number of producers that that are publishing messages to the destination");
|
||||
producers.setDoReset(false);
|
||||
messages = new CountStatisticImpl("messages", "The number of messages that that are being held by the destination");
|
||||
messagesCached = new PollCountStatisticImpl("messagesCached", "The number of messages that are held in the destination's memory cache");
|
||||
processTime = new TimeStatisticImpl("processTime", "information around length of time messages are held by a destination");
|
||||
|
@ -55,7 +58,7 @@ public class DestinationStatistics extends StatsImpl {
|
|||
addStatistic("dequeues", dequeues);
|
||||
addStatistic("inflight", inflight);
|
||||
addStatistic("consumers", consumers);
|
||||
addStatistic("prodcuers", producers);
|
||||
addStatistic("producers", producers);
|
||||
addStatistic("messages", messages);
|
||||
addStatistic("messagesCached", messagesCached);
|
||||
addStatistic("processTime", processTime);
|
||||
|
@ -102,11 +105,13 @@ public class DestinationStatistics extends StatsImpl {
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
enqueues.reset();
|
||||
dequeues.reset();
|
||||
dispatched.reset();
|
||||
inflight.reset();
|
||||
if (this.isDoReset()) {
|
||||
super.reset();
|
||||
enqueues.reset();
|
||||
dequeues.reset();
|
||||
dispatched.reset();
|
||||
inflight.reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
|
|
|
@ -44,8 +44,10 @@ public class CountStatisticImpl extends StatisticImpl implements CountStatistic
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
counter.set(0);
|
||||
if (isDoReset()) {
|
||||
super.reset();
|
||||
counter.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
public long getCount() {
|
||||
|
|
|
@ -32,10 +32,12 @@ public class RangeStatisticImpl extends StatisticImpl {
|
|||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
current = 0;
|
||||
lowWaterMark = 0;
|
||||
highWaterMark = 0;
|
||||
if (isDoReset()) {
|
||||
super.reset();
|
||||
current = 0;
|
||||
lowWaterMark = 0;
|
||||
highWaterMark = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public long getHighWaterMark() {
|
||||
|
|
|
@ -32,22 +32,25 @@ public class StatisticImpl implements Statistic, Resettable {
|
|||
private String description;
|
||||
private long startTime;
|
||||
private long lastSampleTime;
|
||||
private boolean doReset = true;
|
||||
|
||||
public StatisticImpl(String name, String unit, String description) {
|
||||
this.name = name;
|
||||
this.unit = unit;
|
||||
this.description = description;
|
||||
startTime = System.currentTimeMillis();
|
||||
lastSampleTime = startTime;
|
||||
this.startTime = System.currentTimeMillis();
|
||||
this.lastSampleTime = this.startTime;
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
startTime = System.currentTimeMillis();
|
||||
lastSampleTime = startTime;
|
||||
if(isDoReset()) {
|
||||
this.startTime = System.currentTimeMillis();
|
||||
this.lastSampleTime = this.startTime;
|
||||
}
|
||||
}
|
||||
|
||||
protected synchronized void updateSampleTime() {
|
||||
lastSampleTime = System.currentTimeMillis();
|
||||
this.lastSampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
|
@ -60,23 +63,23 @@ public class StatisticImpl implements Statistic, Resettable {
|
|||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
return this.unit;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public synchronized long getStartTime() {
|
||||
return startTime;
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
public synchronized long getLastSampleTime() {
|
||||
return lastSampleTime;
|
||||
return this.lastSampleTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,18 +95,32 @@ public class StatisticImpl implements Statistic, Resettable {
|
|||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the doReset
|
||||
*/
|
||||
public boolean isDoReset() {
|
||||
return this.doReset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param doReset the doReset to set
|
||||
*/
|
||||
public void setDoReset(boolean doReset) {
|
||||
this.doReset = doReset;
|
||||
}
|
||||
|
||||
|
||||
protected synchronized void appendFieldDescription(StringBuffer buffer) {
|
||||
buffer.append(" unit: ");
|
||||
buffer.append(unit);
|
||||
buffer.append(this.unit);
|
||||
buffer.append(" startTime: ");
|
||||
// buffer.append(new Date(startTime));
|
||||
buffer.append(startTime);
|
||||
buffer.append(this.startTime);
|
||||
buffer.append(" lastSampleTime: ");
|
||||
// buffer.append(new Date(lastSampleTime));
|
||||
buffer.append(lastSampleTime);
|
||||
buffer.append(this.lastSampleTime);
|
||||
buffer.append(" description: ");
|
||||
buffer.append(description);
|
||||
buffer.append(this.description);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,11 +43,13 @@ public class TimeStatisticImpl extends StatisticImpl {
|
|||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
count = 0;
|
||||
maxTime = 0;
|
||||
minTime = 0;
|
||||
totalTime = 0;
|
||||
if(isDoReset()) {
|
||||
super.reset();
|
||||
count = 0;
|
||||
maxTime = 0;
|
||||
minTime = 0;
|
||||
totalTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized long getCount() {
|
||||
|
|
Loading…
Reference in New Issue