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.PollCountStatisticImpl;
|
||||||
import org.apache.activemq.management.StatsImpl;
|
import org.apache.activemq.management.StatsImpl;
|
||||||
import org.apache.activemq.management.TimeStatisticImpl;
|
import org.apache.activemq.management.TimeStatisticImpl;
|
||||||
|
import org.apache.tools.ant.taskdefs.condition.IsReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The J2EE Statistics for the a Destination.
|
* 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");
|
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");
|
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 = 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 = 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");
|
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");
|
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");
|
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("dequeues", dequeues);
|
||||||
addStatistic("inflight", inflight);
|
addStatistic("inflight", inflight);
|
||||||
addStatistic("consumers", consumers);
|
addStatistic("consumers", consumers);
|
||||||
addStatistic("prodcuers", producers);
|
addStatistic("producers", producers);
|
||||||
addStatistic("messages", messages);
|
addStatistic("messages", messages);
|
||||||
addStatistic("messagesCached", messagesCached);
|
addStatistic("messagesCached", messagesCached);
|
||||||
addStatistic("processTime", processTime);
|
addStatistic("processTime", processTime);
|
||||||
|
@ -102,12 +105,14 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
if (this.isDoReset()) {
|
||||||
super.reset();
|
super.reset();
|
||||||
enqueues.reset();
|
enqueues.reset();
|
||||||
dequeues.reset();
|
dequeues.reset();
|
||||||
dispatched.reset();
|
dispatched.reset();
|
||||||
inflight.reset();
|
inflight.reset();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
super.setEnabled(enabled);
|
super.setEnabled(enabled);
|
||||||
|
|
|
@ -44,9 +44,11 @@ public class CountStatisticImpl extends StatisticImpl implements CountStatistic
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
if (isDoReset()) {
|
||||||
super.reset();
|
super.reset();
|
||||||
counter.set(0);
|
counter.set(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getCount() {
|
public long getCount() {
|
||||||
return counter.get();
|
return counter.get();
|
||||||
|
|
|
@ -32,11 +32,13 @@ public class RangeStatisticImpl extends StatisticImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
if (isDoReset()) {
|
||||||
super.reset();
|
super.reset();
|
||||||
current = 0;
|
current = 0;
|
||||||
lowWaterMark = 0;
|
lowWaterMark = 0;
|
||||||
highWaterMark = 0;
|
highWaterMark = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getHighWaterMark() {
|
public long getHighWaterMark() {
|
||||||
return highWaterMark;
|
return highWaterMark;
|
||||||
|
|
|
@ -32,22 +32,25 @@ public class StatisticImpl implements Statistic, Resettable {
|
||||||
private String description;
|
private String description;
|
||||||
private long startTime;
|
private long startTime;
|
||||||
private long lastSampleTime;
|
private long lastSampleTime;
|
||||||
|
private boolean doReset = true;
|
||||||
|
|
||||||
public StatisticImpl(String name, String unit, String description) {
|
public StatisticImpl(String name, String unit, String description) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.unit = unit;
|
this.unit = unit;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
startTime = System.currentTimeMillis();
|
this.startTime = System.currentTimeMillis();
|
||||||
lastSampleTime = startTime;
|
this.lastSampleTime = this.startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reset() {
|
public synchronized void reset() {
|
||||||
startTime = System.currentTimeMillis();
|
if(isDoReset()) {
|
||||||
lastSampleTime = startTime;
|
this.startTime = System.currentTimeMillis();
|
||||||
|
this.lastSampleTime = this.startTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void updateSampleTime() {
|
protected synchronized void updateSampleTime() {
|
||||||
lastSampleTime = System.currentTimeMillis();
|
this.lastSampleTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized String toString() {
|
public synchronized String toString() {
|
||||||
|
@ -60,23 +63,23 @@ public class StatisticImpl implements Statistic, Resettable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnit() {
|
public String getUnit() {
|
||||||
return unit;
|
return this.unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized long getStartTime() {
|
public synchronized long getStartTime() {
|
||||||
return startTime;
|
return this.startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized long getLastSampleTime() {
|
public synchronized long getLastSampleTime() {
|
||||||
return lastSampleTime;
|
return this.lastSampleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,17 +96,31 @@ public class StatisticImpl implements Statistic, Resettable {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void appendFieldDescription(StringBuffer buffer) {
|
/**
|
||||||
buffer.append(" unit: ");
|
* @return the doReset
|
||||||
buffer.append(unit);
|
*/
|
||||||
buffer.append(" startTime: ");
|
public boolean isDoReset() {
|
||||||
// buffer.append(new Date(startTime));
|
return this.doReset;
|
||||||
buffer.append(startTime);
|
|
||||||
buffer.append(" lastSampleTime: ");
|
|
||||||
// buffer.append(new Date(lastSampleTime));
|
|
||||||
buffer.append(lastSampleTime);
|
|
||||||
buffer.append(" description: ");
|
|
||||||
buffer.append(description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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(this.unit);
|
||||||
|
buffer.append(" startTime: ");
|
||||||
|
// buffer.append(new Date(startTime));
|
||||||
|
buffer.append(this.startTime);
|
||||||
|
buffer.append(" lastSampleTime: ");
|
||||||
|
// buffer.append(new Date(lastSampleTime));
|
||||||
|
buffer.append(this.lastSampleTime);
|
||||||
|
buffer.append(" description: ");
|
||||||
|
buffer.append(this.description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,14 @@ public class TimeStatisticImpl extends StatisticImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reset() {
|
public synchronized void reset() {
|
||||||
|
if(isDoReset()) {
|
||||||
super.reset();
|
super.reset();
|
||||||
count = 0;
|
count = 0;
|
||||||
maxTime = 0;
|
maxTime = 0;
|
||||||
minTime = 0;
|
minTime = 0;
|
||||||
totalTime = 0;
|
totalTime = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized long getCount() {
|
public synchronized long getCount() {
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue