Source Code Cross Referenced for Statistics.java in  » Database-JDBC-Connection-Pool » proxool » org » logicalcobwebs » proxool » admin » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » proxool » org.logicalcobwebs.proxool.admin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This software is released under a licence similar to the Apache Software Licence.
003:         * See org.logicalcobwebs.proxool.package.html for details.
004:         * The latest version is available at http://proxool.sourceforge.net
005:         */
006:        package org.logicalcobwebs.proxool.admin;
007:
008:        import java.util.Date;
009:
010:        /**
011:         * Implementation of StatisticsIF
012:         *
013:         * @version $Revision: 1.2 $, $Date: 2003/03/03 11:11:59 $
014:         * @author bill
015:         * @author $Author: billhorsman $ (current maintainer)
016:         * @since Proxool 0.7
017:         */
018:        class Statistics implements  StatisticsIF {
019:
020:            private Date startDate;
021:
022:            private Date stopDate;
023:
024:            private long servedCount;
025:
026:            private long refusedCount;
027:
028:            private long totalActiveTime;
029:
030:            /**
031:             * @param startDate see {@link org.logicalcobwebs.proxool.admin.StatisticsIF#getStartDate}
032:             */
033:            protected Statistics(Date startDate) {
034:                this .startDate = startDate;
035:            }
036:
037:            /**
038:             * @see org.logicalcobwebs.proxool.admin.Admin#connectionReturned
039:             */
040:            protected void connectionReturned(long activeTime) {
041:                totalActiveTime += activeTime;
042:                servedCount++;
043:            }
044:
045:            /**
046:             * @see org.logicalcobwebs.proxool.admin.Admin#connectionRefused
047:             */
048:            protected void connectionRefused() {
049:                refusedCount++;
050:            }
051:
052:            /**
053:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getStopDate
054:             */
055:            protected void setStopDate(Date stopDate) {
056:                this .stopDate = stopDate;
057:            }
058:
059:            /**
060:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getStartDate
061:             */
062:            public Date getStartDate() {
063:                return startDate;
064:            }
065:
066:            /**
067:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getStopDate
068:             */
069:            public Date getStopDate() {
070:                return stopDate;
071:            }
072:
073:            /**
074:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getPeriod
075:             */
076:            public long getPeriod() {
077:                if (stopDate != null) {
078:                    return stopDate.getTime() - startDate.getTime();
079:                } else {
080:                    return System.currentTimeMillis() - startDate.getTime();
081:                }
082:            }
083:
084:            /**
085:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getAverageActiveTime
086:             */
087:            public double getAverageActiveTime() {
088:                if (servedCount > 0) {
089:                    return ((double) totalActiveTime / (double) servedCount);
090:                } else {
091:                    return 0.0;
092:                }
093:            }
094:
095:            /**
096:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getAverageActiveCount
097:             */
098:            public double getAverageActiveCount() {
099:                return (double) totalActiveTime / (double) getPeriod();
100:            }
101:
102:            /**
103:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getServedPerSecond
104:             */
105:            public double getServedPerSecond() {
106:                return (double) servedCount / ((double) getPeriod() / 1000.0);
107:            }
108:
109:            /**
110:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getRefusedPerSecond
111:             */
112:            public double getRefusedPerSecond() {
113:                return (double) refusedCount / ((double) getPeriod() / 1000.0);
114:            }
115:
116:            /**
117:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getServedCount
118:             */
119:            public long getServedCount() {
120:                return servedCount;
121:            }
122:
123:            /**
124:             * @see org.logicalcobwebs.proxool.admin.StatisticsIF#getRefusedCount
125:             */
126:            public long getRefusedCount() {
127:                return refusedCount;
128:            }
129:
130:        }
131:
132:        /*
133:         Revision history:
134:         $Log: Statistics.java,v $
135:         Revision 1.2  2003/03/03 11:11:59  billhorsman
136:         fixed licence
137:
138:         Revision 1.1  2003/02/19 23:36:51  billhorsman
139:         renamed monitor package to admin
140:
141:         Revision 1.3  2003/01/31 16:53:22  billhorsman
142:         checkstyle
143:
144:         Revision 1.2  2003/01/31 16:38:53  billhorsman
145:         doc (and removing public modifier for classes where possible)
146:
147:         Revision 1.1  2003/01/31 11:35:57  billhorsman
148:         improvements to servlet (including connection details)
149:
150:         Revision 1.1  2003/01/30 17:20:13  billhorsman
151:         fixes, improvements and doc
152:
153:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.