added some more JMX stats

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@357195 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2005-12-16 17:48:33 +00:00
parent 2c6156085c
commit 24389c4929
6 changed files with 119 additions and 34 deletions

View File

@ -115,6 +115,13 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
taskRunner = null;
}
/**
* Returns the number of messages to be dispatched to this connection
*/
public int getDispatchQueueSize() {
return dispatchQueue.size();
}
public void start() throws Exception {
this.dispatch(connector.getBrokerInfo());
}

View File

@ -36,7 +36,8 @@ public interface Connection extends Service {
/**
* Sends a message to the client.
*
* @param message the message to send to the client.
* @param message
* the message to send to the client.
*/
public void dispatchSync(Command message);
@ -47,9 +48,9 @@ public interface Connection extends Service {
*/
public void dispatchAsync(Command command);
/**
* Services a client command and submits it to the broker.
*
* @param command
*/
public Response service(Command command);
@ -71,7 +72,6 @@ public interface Connection extends Service {
*/
public boolean isBlocked();
/**
* @return true if the Connection is connected
*/
@ -82,4 +82,8 @@ public interface Connection extends Service {
*/
public boolean isActive();
/**
* Returns the number of messages to be dispatched to this connection
*/
public int getDispatchQueueSize();
}

View File

@ -66,4 +66,10 @@ public class ConnectionView implements ConnectionViewMBean {
}
/**
* Returns the number of messages to be dispatched to this connection
*/
public int getDispatchQueueSize() {
return connection.getDispatchQueueSize();
}
}

View File

@ -31,7 +31,6 @@ public interface ConnectionViewMBean extends Service {
*/
public boolean isBlocked();
/**
* @return true if the Connection is connected
*/
@ -42,4 +41,8 @@ public interface ConnectionViewMBean extends Service {
*/
public boolean isActive();
/**
* Returns the number of messages to be dispatched to this connection
*/
public int getDispatchQueueSize();
}

View File

@ -20,6 +20,7 @@ package org.activemq.broker.jmx;
import org.activemq.broker.Connector;
import org.activemq.command.BrokerInfo;
import org.activemq.command.RedeliveryPolicy;
public class ConnectorView implements ConnectorViewMBean {
@ -33,12 +34,61 @@ public class ConnectorView implements ConnectorViewMBean {
connector.start();
}
public String getBrokerName() {
return getBrokerInfo().getBrokerName();
}
public void stop() throws Exception {
connector.stop();
}
public String getBrokerURL() {
return getBrokerInfo().getBrokerURL();
}
public BrokerInfo getBrokerInfo() {
return connector.getBrokerInfo();
}
public short getBackOffMultiplier() {
return getRedeliveryPolicy().getBackOffMultiplier();
}
public long getInitialRedeliveryDelay() {
return getRedeliveryPolicy().getInitialRedeliveryDelay();
}
public int getMaximumRedeliveries() {
return getRedeliveryPolicy().getMaximumRedeliveries();
}
public boolean isUseExponentialBackOff() {
return getRedeliveryPolicy().isUseExponentialBackOff();
}
public void setBackOffMultiplier(short backOffMultiplier) {
getRedeliveryPolicy().setBackOffMultiplier(backOffMultiplier);
}
public void setInitialRedeliveryDelay(long initialRedeliveryDelay) {
getRedeliveryPolicy().setInitialRedeliveryDelay(initialRedeliveryDelay);
}
public void setMaximumRedeliveries(int maximumRedeliveries) {
getRedeliveryPolicy().setMaximumRedeliveries(maximumRedeliveries);
}
public void setUseExponentialBackOff(boolean useExponentialBackOff) {
getRedeliveryPolicy().setUseExponentialBackOff(useExponentialBackOff);
}
public RedeliveryPolicy getRedeliveryPolicy() {
RedeliveryPolicy redeliveryPolicy = getBrokerInfo().getRedeliveryPolicy();
if (redeliveryPolicy == null) {
redeliveryPolicy = new RedeliveryPolicy();
getBrokerInfo().setRedeliveryPolicy(redeliveryPolicy);
}
return redeliveryPolicy;
}
}

View File

@ -20,9 +20,24 @@ package org.activemq.broker.jmx;
import org.activemq.Service;
import org.activemq.command.BrokerInfo;
import org.activemq.command.RedeliveryPolicy;
public interface ConnectorViewMBean extends Service {
public BrokerInfo getBrokerInfo();
public short getBackOffMultiplier();
public long getInitialRedeliveryDelay();
public int getMaximumRedeliveries();
public boolean isUseExponentialBackOff();
public void setBackOffMultiplier(short backOffMultiplier);
public void setInitialRedeliveryDelay(long initialRedeliveryDelay);
public void setMaximumRedeliveries(int maximumRedeliveries);
public void setUseExponentialBackOff(boolean useExponentialBackOff);
}