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