    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     * Obtain the time (using the same basis as
    035     * {@link System#currentTimeMillis()}) that pooled object was created.
    036     *
    037     * @return The creation time for the pooled object
    038     */
    039    long getCreateTime();
    040
    041    /**
    042     * Obtain the time that pooled object was created.
    043     *
    044     * @return The creation time for the pooled object formatted as
    045     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
    046     */
    047    String getCreateTimeFormatted();
    048
    049    /**
    050     * Obtain the time (using the same basis as
    051     * {@link System#currentTimeMillis()}) the polled object was last borrowed.
    052     *
    053     * @return The time the pooled object was last borrowed
    054     */
    055    long getLastBorrowTime();
    056
    057    /**
    058     * Obtain the time that pooled object was last borrowed.
    059     *
    060     * @return The last borrowed time for the pooled object formated as
    061     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
    062     */
    063    String getLastBorrowTimeFormatted();
    064
    065    /**
    066     * Obtain the stack trace recorded when the pooled object was last borrowed.
    067     *
    068     * @return The stack trace showing which code last borrowed the pooled
    069     *         object
    070     */
    071    String getLastBorrowTrace();
    072
    073
    074    /**
    075     * Obtain the time (using the same basis as
    076     * {@link System#currentTimeMillis()})the wrapped object was last returned.
    077     *
    078     * @return The time the object was last returned
    079     */
    080    long getLastReturnTime();
    081
    082    /**
    083     * Obtain the time that pooled object was last returned.
    084     *
    085     * @return The last returned time for the pooled object formated as
    086     *         <code>yyyy-MM-dd HH:mm:ss Z</code>
    087     */
    088    String getLastReturnTimeFormatted();
    089
    090    /**
    091     * Obtain the name of the class of the pooled object.
    092     *
    093     * @return The pooled object's class name
    094     *
    095     * @see Class#getName()
    096     */
    097    String getPooledObjectType();
    098
    099    /**
    100     * Provides a String form of the wrapper for debug purposes. The format is
    101     * not fixed and may change at any time.
    102     *
    103     * @return A string representation of the pooled object
    104     *
    105     * @see Object#toString()
    106     */
    107    String getPooledObjectToString();
    108
    109    /**
    110     * Get the number of times this object has been borrowed.
    111     * @return The number of times this object has been borrowed.
    112     * @since 2.1
    113     */
    114    long getBorrowedCount();
    115}