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,11 +105,13 @@ public class DestinationStatistics extends StatsImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
if (this.isDoReset()) {
|
||||||
enqueues.reset();
|
super.reset();
|
||||||
dequeues.reset();
|
enqueues.reset();
|
||||||
dispatched.reset();
|
dequeues.reset();
|
||||||
inflight.reset();
|
dispatched.reset();
|
||||||
|
inflight.reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
|
|
|
@ -44,8 +44,10 @@ public class CountStatisticImpl extends StatisticImpl implements CountStatistic
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
if (isDoReset()) {
|
||||||
counter.set(0);
|
super.reset();
|
||||||
|
counter.set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCount() {
|
public long getCount() {
|
||||||
|
|
|
@ -32,10 +32,12 @@ public class RangeStatisticImpl extends StatisticImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
if (isDoReset()) {
|
||||||
current = 0;
|
super.reset();
|
||||||
lowWaterMark = 0;
|
current = 0;
|
||||||
highWaterMark = 0;
|
lowWaterMark = 0;
|
||||||
|
highWaterMark = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getHighWaterMark() {
|
public long getHighWaterMark() {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,18 +95,32 @@ public class StatisticImpl implements Statistic, Resettable {
|
||||||
public void setEnabled(boolean enabled) {
|
public void setEnabled(boolean enabled) {
|
||||||
this.enabled = 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) {
|
protected synchronized void appendFieldDescription(StringBuffer buffer) {
|
||||||
buffer.append(" unit: ");
|
buffer.append(" unit: ");
|
||||||
buffer.append(unit);
|
buffer.append(this.unit);
|
||||||
buffer.append(" startTime: ");
|
buffer.append(" startTime: ");
|
||||||
// buffer.append(new Date(startTime));
|
// buffer.append(new Date(startTime));
|
||||||
buffer.append(startTime);
|
buffer.append(this.startTime);
|
||||||
buffer.append(" lastSampleTime: ");
|
buffer.append(" lastSampleTime: ");
|
||||||
// buffer.append(new Date(lastSampleTime));
|
// buffer.append(new Date(lastSampleTime));
|
||||||
buffer.append(lastSampleTime);
|
buffer.append(this.lastSampleTime);
|
||||||
buffer.append(" description: ");
|
buffer.append(" description: ");
|
||||||
buffer.append(description);
|
buffer.append(this.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,13 @@ public class TimeStatisticImpl extends StatisticImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reset() {
|
public synchronized void reset() {
|
||||||
super.reset();
|
if(isDoReset()) {
|
||||||
count = 0;
|
super.reset();
|
||||||
maxTime = 0;
|
count = 0;
|
||||||
minTime = 0;
|
maxTime = 0;
|
||||||
totalTime = 0;
|
minTime = 0;
|
||||||
|
totalTime = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized long getCount() {
|
public synchronized long getCount() {
|
||||||
|
|
Loading…
Reference in New Issue