    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.commons.pool2.impl;
    018
    019import java.util.Set;
    020
    021/**
    022 * Defines the methods that will be made available via JMX.
    023 *
    024 * NOTE: This interface exists only to define those attributes and methods that
    025 *       will be made available via JMX. It must not be implemented by clients
    026 *       as it is subject to change between major, minor and patch version
    027 *       releases of commons pool. Clients that implement this interface may
    028 *       not, therefore, be able to upgrade to a new minor or patch release
    029 *       without requiring code changes.
    030 *
    031 * @since 2.0
    032 */
    033public interface GenericObjectPoolMXBean {
    034
    035    // Getters for basic configuration settings
    036
    037    /**
    038     * See {@link GenericObjectPool#getBlockWhenExhausted()}
    039     * @return See {@link GenericObjectPool#getBlockWhenExhausted()}
    040     */
    041    boolean getBlockWhenExhausted();
    042
    043    /**
    044     * See {@link GenericObjectPool#getBorrowedCount()}
    045     * @return See {@link GenericObjectPool#getBorrowedCount()}
    046     */
    047    long getBorrowedCount();
    048
    049    /**
    050     * See {@link GenericObjectPool#getCreatedCount()}
    051     * @return See {@link GenericObjectPool#getCreatedCount()}
    052     */
    053    long getCreatedCount();
    054
    055    /**
    056     * See {@link GenericObjectPool#getCreationStackTrace()}
    057     * @return See {@link GenericObjectPool#getCreationStackTrace()}
    058     */
    059    String getCreationStackTrace();
    060
    061    /**
    062     * See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}
    063     * @return See {@link GenericObjectPool#getDestroyedByBorrowValidationCount()}
    064     */
    065    long getDestroyedByBorrowValidationCount();
    066
    067    /**
    068     * See {@link GenericObjectPool#getDestroyedByEvictorCount()}
    069     * @return See {@link GenericObjectPool#getDestroyedByEvictorCount()}
    070     */
    071    long getDestroyedByEvictorCount();
    072
    073    /**
    074     * See {@link GenericObjectPool#getDestroyedCount()}
    075     * @return See {@link GenericObjectPool#getDestroyedCount()}
    076     */
    077    long getDestroyedCount();
    078
    079    /**
    080     * See {@link GenericObjectPool#getFactoryType()}
    081     * @return See {@link GenericObjectPool#getFactoryType()}
    082     */
    083    String getFactoryType();
    084
    085    /**
    086     * See {@link GenericObjectPool#getLifo()}
    087     * @return See {@link GenericObjectPool#getLifo()}
    088     */
    089    boolean getFairness();
    090
    091    /**
    092     * See {@link GenericObjectPool#getFairness()}
    093     * @return See {@link GenericObjectPool#getFairness()}
    094     */
    095    boolean getLifo();
    096
    097    /**
    098     * See {@link GenericObjectPool#getLogAbandoned()}
    099     * @return See {@link GenericObjectPool#getLogAbandoned()}
    100     */
    101    boolean getLogAbandoned();
    102
    103    /**
    104     * See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}
    105     * @return See {@link GenericObjectPool#getMaxBorrowWaitTimeMillis()}
    106     */
    107    long getMaxBorrowWaitTimeMillis();
    108
    109    /**
    110     * See {@link GenericObjectPool#getMaxIdle()}
    111     * @return See {@link GenericObjectPool#getMaxIdle()}
    112     */
    113    int getMaxIdle();
    114
    115    /**
    116     * See {@link GenericObjectPool#getMaxTotal()}
    117     * @return See {@link GenericObjectPool#getMaxTotal()}
    118     */
    119    int getMaxTotal();
    120
    121    /**
    122     * See {@link GenericObjectPool#getMaxWaitDuration()}
    123     * @return See {@link GenericObjectPool#getMaxWaitDuration()}
    124     */
    125    long getMaxWaitMillis();
    126
    127    /**
    128     * See {@link GenericObjectPool#getMeanActiveTimeMillis()}
    129     * @return See {@link GenericObjectPool#getMeanActiveTimeMillis()}
    130     */
    131    long getMeanActiveTimeMillis();
    132
    133    /**
    134     * See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}
    135     * @return See {@link GenericObjectPool#getMeanBorrowWaitTimeMillis()}
    136     */
    137    long getMeanBorrowWaitTimeMillis();
    138
    139    // Getters for monitoring attributes
    140
    141    /**
    142     * See {@link GenericObjectPool#getMeanIdleTimeMillis()}
    143     * @return See {@link GenericObjectPool#getMeanIdleTimeMillis()}
    144     */
    145    long getMeanIdleTimeMillis();
    146
    147    /**
    148     * See {@link GenericObjectPool#getMinEvictableIdleDuration()}
    149     * @return See {@link GenericObjectPool#getMinEvictableIdleDuration()}
    150     */
    151    long getMinEvictableIdleTimeMillis();
    152
    153    /**
    154     * See {@link GenericObjectPool#getMinIdle()}
    155     * @return See {@link GenericObjectPool#getMinIdle()}
    156     */
    157    int getMinIdle();
    158
    159    /**
    160     * See {@link GenericObjectPool#getNumActive()}
    161     * @return See {@link GenericObjectPool#getNumActive()}
    162     */
    163    int getNumActive();
    164
    165    /**
    166     * See {@link GenericObjectPool#getNumIdle()}
    167     * @return See {@link GenericObjectPool#getNumIdle()}
    168     */
    169    int getNumIdle();
    170
    171    /**
    172     * See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
    173     * @return See {@link GenericObjectPool#getNumTestsPerEvictionRun()}
    174     */
    175    int getNumTestsPerEvictionRun();
    176
    177    /**
    178     * See {@link GenericObjectPool#getNumWaiters()}
    179     * @return See {@link GenericObjectPool#getNumWaiters()}
    180     */
    181    int getNumWaiters();
    182
    183    /**
    184     * See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
    185     * @return See {@link GenericObjectPool#getRemoveAbandonedOnBorrow()}
    186     */
    187    boolean getRemoveAbandonedOnBorrow();
    188
    189    /**
    190     * See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
    191     * @return See {@link GenericObjectPool#getRemoveAbandonedOnMaintenance()}
    192     */
    193    boolean getRemoveAbandonedOnMaintenance();
    194
    195    /**
    196     * See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}
    197     * @return See {@link GenericObjectPool#getRemoveAbandonedTimeoutDuration()}
    198     */
    199    int getRemoveAbandonedTimeout();
    200
    201    /**
    202     * See {@link GenericObjectPool#getReturnedCount()}
    203     * @return See {@link GenericObjectPool#getReturnedCount()}
    204     */
    205    long getReturnedCount();
    206
    207    /**
    208     * See {@link GenericObjectPool#getTestOnBorrow()}
    209     * @return See {@link GenericObjectPool#getTestOnBorrow()}
    210     */
    211    boolean getTestOnBorrow();
    212
    213    // Getters for abandoned object removal configuration
    214
    215    /**
    216     * See {@link GenericObjectPool#getTestOnCreate()}
    217     * @return See {@link GenericObjectPool#getTestOnCreate()}
    218     * @since 2.2
    219     */
    220    boolean getTestOnCreate();
    221
    222    /**
    223     * See {@link GenericObjectPool#getTestOnReturn()}
    224     * @return See {@link GenericObjectPool#getTestOnReturn()}
    225     */
    226    boolean getTestOnReturn();
    227
    228    /**
    229     * See {@link GenericObjectPool#getTestWhileIdle()}
    230     * @return See {@link GenericObjectPool#getTestWhileIdle()}
    231     */
    232    boolean getTestWhileIdle();
    233
    234    /**
    235     * See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}
    236     * @return See {@link GenericObjectPool#getDurationBetweenEvictionRuns()}
    237     */
    238    long getTimeBetweenEvictionRunsMillis();
    239
    240    /**
    241     * See {@link GenericObjectPool#isAbandonedConfig()}
    242     * @return See {@link GenericObjectPool#isAbandonedConfig()}
    243     */
    244    boolean isAbandonedConfig();
    245
    246    /**
    247     * See {@link GenericObjectPool#isClosed()}
    248     * @return See {@link GenericObjectPool#isClosed()}
    249     */
    250    boolean isClosed();
    251
    252    /**
    253     * See {@link GenericObjectPool#listAllObjects()}
    254     * @return See {@link GenericObjectPool#listAllObjects()}
    255     */
    256    Set<DefaultPooledObjectInfo> listAllObjects();
    257}