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

@ -1,21 +1,21 @@
/**
* <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
*
* Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
* <a href="http://activemq.org">ActiveMQ: The Open Source Message Fabric</a>
*
* Copyright 2005 (C) LogicBlaze, Inc. http://www.logicblaze.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
package org.activemq.broker;
import org.activemq.Service;
@ -36,10 +36,11 @@ 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);
/**
* Sends a message to the client.
*
@ -47,39 +48,42 @@ public interface Connection extends Service {
*/
public void dispatchAsync(Command command);
/**
* Services a client command and submits it to the broker.
* Services a client command and submits it to the broker.
*
* @param command
*/
public Response service(Command command);
/**
* Handles an unexpected error associated with a connection.
*
* @param error
*/
public void serviceException(Throwable error);
/**
* @return true if the Connection is slow
*/
public boolean isSlow();
/**
* @return if after being marked, the Connection is still writing
*/
public boolean isBlocked();
/**
* @return true if the Connection is connected
*/
public boolean isConnected();
/**
* @return true if the Connection is active
*/
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

@ -25,21 +25,24 @@ public interface ConnectionViewMBean extends Service {
* @return true if the Connection is slow
*/
public boolean isSlow();
/**
* @return if after being marked, the Connection is still writing
*/
public boolean isBlocked();
/**
* @return true if the Connection is connected
*/
public boolean isConnected();
/**
* @return true if the Connection is active
*/
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);
}