001package org.javasimon.jdbc4.jmx;
002
003import java.beans.ConstructorProperties;
004
005/**
006 * Object is used as transfer object for JDBC MBean. Object holds data for JDBC runtime objects: connection, statements
007 * and result sets. These objects has same data structure, so it's used for transfering data from JDBC Simon hierarchy
008 * through jmx.
009 *
010 * @author Radovan Sninsky
011 * @since 2.0
012 */
013public class JdbcObjectInfo {
014
015        private long active;
016        private long peak;
017        private long peakTime;
018        private long opened;
019        private long closed;
020        private long min;
021        private long max;
022        private long total;
023
024        /**
025         * Class constructor. Constructor is used on both side, in server and also in client code to initialize all properties
026         * of object. On client side constructor is used by jmx internal mechanism to initialize object from composite data object.
027         *
028         * @param active actual active objects (conn, stmt, rset) in runtime
029         * @param peak max active count
030         * @param peakTime time when max active count occured
031         * @param opened count of opened objects (conn, stmt, rset)
032         * @param closed count of closed objects (conn, stmt, rset)
033         * @param min minimal lifetime of objects (conn, stmt, rset)
034         * @param max maximum lifetime of objects (conn, stmt, rset)
035         * @param total sum of all lifetimes of object (conn, stmt, rset)
036         */
037        @ConstructorProperties({"active", "peak", "peakTime", "opened", "closed", "min", "max", "total"})
038        public JdbcObjectInfo(long active, long peak, long peakTime, long opened, long closed, long min, long max, long total) {
039                this.active = active;
040                this.peak = peak;
041                this.peakTime = peakTime;
042                this.opened = opened;
043                this.closed = closed;
044                this.min = min;
045                this.max = max;
046                this.total = total;
047        }
048
049        /**
050         * Getter for actual active objects (conn, stmt, rset) in runtime.
051         *
052         * @return active object
053         */
054        public long getActive() {
055                return active;
056        }
057
058        /**
059         * Getter for max active count.
060         *
061         * @return max active count
062         */
063        public long getPeak() {
064                return peak;
065        }
066
067        /**
068         * Getter for peak time.
069         *
070         * @return time when max active count occured
071         */
072        public long getPeakTime() {
073                return peakTime;
074        }
075
076        /**
077         * Getter for count of opened objects (conn, stmt, rset).
078         *
079         * @return count of opened objects (conn, stmt, rset)
080         */
081        public long getOpened() {
082                return opened;
083        }
084
085        /**
086         * Getter for count of closed objects (conn, stmt, rset).
087         *
088         * @return count of closed objects (conn, stmt, rset)
089         */
090        public long getClosed() {
091                return closed;
092        }
093
094        /**
095         * Getter for minimal lifetime of objects (conn, stmt, rset).
096         *
097         * @return minimal lifetime of objects (conn, stmt, rset)
098         */
099        public long getMin() {
100                return min;
101        }
102
103        /**
104         * Getter for maximum lifetime of objects (conn, stmt, rset).
105         *
106         * @return maximum lifetime of objects (conn, stmt, rset)
107         */
108        public long getMax() {
109                return max;
110        }
111
112        /**
113         * Getter for sum of all lifetimes of object (conn, stmt, rset).
114         *
115         * @return sum of all lifetimes of object (conn, stmt, rset)
116         */
117        public long getTotal() {
118                return total;
119        }
120}