    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
    019/**
    020 * The interface that defines the information about pooled objects that will be
    021 * exposed via JMX.
    022 *
    023 * NOTE: This interface exists only to define those attributes and methods that
    024 *       will be made available via JMX. It must not be implemented by clients
    025 *       as it is subject to change between major, minor and patch version
    026 *       releases of commons pool. Clients that implement this interface may
    027 *       not, therefore, be able to upgrade to a new minor or patch release
    028 *       without requiring code changes.
    029 *
    030 * @since 2.0
    031 */
    032public interface DefaultPooledObjectInfoMBean {
    033    /**
    034     * Get the number of times this object has been borrowed.
    035     * @return The number of times this object has been borrowed.
    036     * @since 2.1
    037     */
    038    long getBorrowedCount();
    039
    040    /**
    041     * Obtain the time (using the same basis as
    042     * {@link System#currentTimeMillis()}) that pooled object was created.
    043     *
    044     * @return The creation time for the pooled object
    045     */
    046    long getCreateTime();
    047
    048    /**
    049     * Obtain the time that pooled object was created.
    050     *
    051     * @return The creation time for the pooled object formatted as
    052     *         {@code yyyy-MM-dd HH:mm:ss Z}
    053     */
    054    String getCreateTimeFormatted();
    055
    056    /**
    057     * Obtain the time (using the same basis as
    058     * {@link System#currentTimeMillis()}) the polled object was last borrowed.
    059     *
    060     * @return The time the pooled object was last borrowed
    061     */
    062    long getLastBorrowTime();
    063
    064    /**
    065     * Obtain the time that pooled object was last borrowed.
    066     *
    067     * @return The last borrowed time for the pooled object formatted as
    068     *         {@code yyyy-MM-dd HH:mm:ss Z}
    069     */
    070    String getLastBorrowTimeFormatted();
    071
    072
    073    /**
    074     * Obtain the stack trace recorded when the pooled object was last borrowed.
    075     *
    076     * @return The stack trace showing which code last borrowed the pooled
    077     *         object
    078     */
    079    String getLastBorrowTrace();
    080
    081    /**
    082     * Obtain the time (using the same basis as
    083     * {@link System#currentTimeMillis()})the wrapped object was last returned.
    084     *
    085     * @return The time the object was last returned
    086     */
    087    long getLastReturnTime();
    088
    089    /**
    090     * Obtain the time that pooled object was last returned.
    091     *
    092     * @return The last returned time for the pooled object formatted as
    093     *         {@code yyyy-MM-dd HH:mm:ss Z}
    094     */
    095    String getLastReturnTimeFormatted();
    096
    097    /**
    098     * Provides a String form of the wrapper for debug purposes. The format is
    099     * not fixed and may change at any time.
    100     *
    101     * @return A string representation of the pooled object
    102     *
    103     * @see Object#toString()
    104     */
    105    String getPooledObjectToString();
    106
    107    /**
    108     * Obtain the name of the class of the pooled object.
    109     *
    110     * @return The pooled object's class name
    111     *
    112     * @see Class#getName()
    113     */
    114    String getPooledObjectType();
    115}