001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker.jmx;
018
019import javax.management.ObjectName;
020
021import org.apache.activemq.Service;
022import org.apache.activemq.broker.TransportConnectionState;
023import org.apache.activemq.state.TransactionState;
024
025import java.util.Collection;
026
027public interface ConnectionViewMBean extends Service {
028    /**
029     * @return true if the Connection is slow
030     */
031    @MBeanInfo("Connection is slow.")
032    boolean isSlow();
033
034    /**
035     * @return if after being marked, the Connection is still writing
036     */
037    @MBeanInfo("Connection is blocked.")
038    boolean isBlocked();
039
040    /**
041     * @return true if the Connection is connected
042     */
043    @MBeanInfo("Connection is connected to the broker.")
044    boolean isConnected();
045
046    /**
047     * @return true if the Connection is active
048     */
049    @MBeanInfo("Connection is active (both connected and receiving messages).")
050    boolean isActive();
051
052    /**
053     * Resets the statistics
054     */
055    @MBeanInfo("Resets the statistics")
056    void resetStatistics();
057
058    /**
059     * Returns the source address for this connection
060     *
061     * @return the source address for this connection
062     */
063    @MBeanInfo("source address for this connection")
064    String getRemoteAddress();
065
066    /**
067     * Returns the client identifier for this connection
068     *
069     * @return the the client identifier for this connection
070     */
071    @MBeanInfo("client id for this connection")
072    String getClientId();
073
074    /**
075     * Returns the number of messages to be dispatched to this connection
076     * @return the  number of messages pending dispatch
077     */
078    @MBeanInfo("The number of messages pending dispatch")
079    public int getDispatchQueueSize();
080
081    /**
082     * Returns the User Name used to authorize creation of this Connection.
083     * This value can be null if display of user name information is disabled.
084     *
085     * @return the name of the user that created this Connection
086     */
087    @MBeanInfo("User Name used to authorize creation of this connection")
088    String getUserName();
089
090    /**
091     * Returns the ObjectNames of all the Consumers created by this Connection.
092     *
093     * @return the ObjectNames of all Consumers created by this Connection.
094     */
095    @MBeanInfo("The ObjectNames of all Consumers created by this Connection")
096    ObjectName[] getConsumers();
097
098    /**
099     * Returns the ObjectNames of all the Producers created by this Connection.
100     *
101     * @return the ObjectNames of all Producers created by this Connection.
102     */
103    @MBeanInfo("The ObjectNames of all Producers created by this Connection")
104    ObjectName[] getProducers();
105
106    /**
107     * Returns the number of active transactions established on this Connection.
108     *
109     * @return the number of active transactions established on this Connection..
110     */
111    @MBeanInfo("The number of active transactions established on this Connection.")
112    public int getActiveTransactionCount();
113
114    /**
115     * Returns the number of active transactions established on this Connection.
116     *
117     * @return the number of active transactions established on this Connection..
118     */
119    @MBeanInfo("The age in ms of the oldest active transaction established on this Connection.")
120    public Long getOldestActiveTransactionDuration();
121}