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;
022
023public interface ConnectionViewMBean extends Service {
024
025    /**
026     * @return true if the Connection is slow
027     */
028    @MBeanInfo("Connection is slow.")
029    boolean isSlow();
030
031    /**
032     * @return if after being marked, the Connection is still writing
033     */
034    @MBeanInfo("Connection is blocked.")
035    boolean isBlocked();
036
037    /**
038     * @return true if the Connection is connected
039     */
040    @MBeanInfo("Connection is connected to the broker.")
041    boolean isConnected();
042
043    /**
044     * @return true if the Connection is active
045     */
046    @MBeanInfo("Connection is active (both connected and receiving messages).")
047    boolean isActive();
048
049    /**
050     * Resets the statistics
051     */
052    @MBeanInfo("Resets the statistics")
053    void resetStatistics();
054
055    /**
056     * Returns the source address for this connection
057     *
058     * @return the source address for this connection
059     */
060    @MBeanInfo("source address for this connection")
061    String getRemoteAddress();
062
063    /**
064     * Returns the client identifier for this connection
065     *
066     * @return the the client identifier for this connection
067     */
068    @MBeanInfo("client id for this connection")
069    String getClientId();
070
071    /**
072     * Returns the number of messages to be dispatched to this connection
073     * @return the  number of messages pending dispatch
074     */
075    @MBeanInfo("The number of messages pending dispatch")
076    public int getDispatchQueueSize();
077
078    /**
079     * Returns the User Name used to authorize creation of this Connection.
080     * This value can be null if display of user name information is disabled.
081     *
082     * @return the name of the user that created this Connection
083     */
084    @MBeanInfo("User Name used to authorize creation of this connection")
085    String getUserName();
086
087    /**
088     * Returns the ObjectNames of all the Consumers created by this Connection.
089     *
090     * @return the ObjectNames of all Consumers created by this Connection.
091     */
092    @MBeanInfo("The ObjectNames of all Consumers created by this Connection")
093    ObjectName[] getConsumers();
094
095    /**
096     * Returns the ObjectNames of all the Producers created by this Connection.
097     *
098     * @return the ObjectNames of all Producers created by this Connection.
099     */
100    @MBeanInfo("The ObjectNames of all Producers created by this Connection")
101    ObjectName[] getProducers();
102
103    /**
104     * Returns the number of active transactions established on this Connection.
105     *
106     * @return the number of active transactions established on this Connection..
107     */
108    @MBeanInfo("The number of active transactions established on this Connection.")
109    public int getActiveTransactionCount();
110
111    /**
112     * Returns the number of active transactions established on this Connection.
113     *
114     * @return the number of active transactions established on this Connection..
115     */
116    @MBeanInfo("The age in ms of the oldest active transaction established on this Connection.")
117    public Long getOldestActiveTransactionDuration();
118
119}