Source Code Cross Referenced for TomcatWebConnectorStatsImpl.java in  » EJB-Server-geronimo » management » org » apache » geronimo » management » geronimo » stats » 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 » EJB Server geronimo » management » org.apache.geronimo.management.geronimo.stats 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:         */package org.apache.geronimo.management.geronimo.stats;
017:
018:        import javax.management.j2ee.statistics.CountStatistic;
019:        import javax.management.j2ee.statistics.RangeStatistic;
020:        import javax.management.j2ee.statistics.TimeStatistic;
021:
022:        import org.apache.geronimo.management.stats.StatsImpl;
023:        import org.apache.geronimo.management.stats.StatisticImpl;
024:        import org.apache.geronimo.management.stats.CountStatisticImpl;
025:        import org.apache.geronimo.management.stats.RangeStatisticImpl;
026:        import org.apache.geronimo.management.stats.BoundedRangeStatisticImpl;
027:        import org.apache.geronimo.management.stats.TimeStatisticImpl;
028:
029:        /**
030:         * Geronimo implementation of the JSR-77 style WebConnectorStats interface. This
031:         * is not required by JSR-77, but provides useful statistics. This will be
032:         * discovered by mejb using 'stats' attribute.
033:         * 
034:         * @version $Revision: 581936 $ $Date: 2007-10-04 07:46:56 -0700 (Thu, 04 Oct 2007) $
035:         */
036:
037:        public class TomcatWebConnectorStatsImpl extends StatsImpl implements 
038:                TomcatWebConnectorStats {
039:            private TimeStatisticImpl requestTime; // total, max, count
040:
041:            private CountStatisticImpl activeRequestCount;
042:
043:            private CountStatisticImpl errorCount;
044:
045:            private CountStatisticImpl bytesSentCount;
046:
047:            private CountStatisticImpl bytesReceivedCount;
048:
049:            // these come from ThreadPool
050:            private RangeStatisticImpl openConnectionCount;
051:
052:            private CountStatisticImpl busyThreadCount;
053:
054:            // TODO - change the name to BoundedRangeStatisticsImpl
055:            private BoundedRangeStatisticImpl busyThreads;
056:
057:            // TODO - spareThreads metrics = current - busy, maxSpareThreads, minSpareThreads 
058:
059:            public TomcatWebConnectorStatsImpl() {
060:                requestTime = new TimeStatisticImpl("Request Time",
061:                        StatisticImpl.UNIT_TIME_MILLISECOND,
062:                        "The time to process all requests");
063:                activeRequestCount = new CountStatisticImpl(
064:                        "Active Request Count", StatisticImpl.UNIT_COUNT,
065:                        "currently active requests ", 0);
066:                errorCount = new CountStatisticImpl("Error Count",
067:                        StatisticImpl.UNIT_COUNT,
068:                        "The numbet of Errors during the observed period", 0);
069:                bytesSentCount = new CountStatisticImpl("Bytes Sent",
070:                        StatisticImpl.UNIT_COUNT,
071:                        "The number of bytes sent during the observerd period",
072:                        0);
073:                bytesReceivedCount = new CountStatisticImpl(
074:                        "Bytes Received",
075:                        StatisticImpl.UNIT_COUNT,
076:                        "The number of bytes received during the observerd period",
077:                        0);
078:                openConnectionCount = new RangeStatisticImpl(
079:                        "" + "Open Connections",
080:                        StatisticImpl.UNIT_COUNT,
081:                        "Range for connections opened during the observed period",
082:                        0); // all 0's
083:                busyThreads = new BoundedRangeStatisticImpl(
084:                        "Busy Threads",
085:                        StatisticImpl.UNIT_COUNT,
086:                        "BoundedRange for Threads currently busy serving requests",
087:                        0, 0, 0);
088:                addStat("RequestTime", requestTime); // better name
089:                addStat("activeRequestCount", activeRequestCount);
090:                addStat("errorCount", errorCount);
091:                addStat("bytesSent", bytesSentCount);
092:                addStat("bytesReceived", bytesReceivedCount);
093:                addStat("openConnectionCount", openConnectionCount);
094:                addStat("busyThreads", busyThreads);
095:            }
096:
097:            public RangeStatistic getActiveRequestCount() {
098:                // TODO 
099:                return null;
100:            }
101:
102:            public TimeStatistic getRequestTime() {
103:                return requestTime;
104:            }
105:
106:            public CountStatistic getErrorCount() {
107:                return errorCount;
108:            }
109:
110:            public CountStatistic getBytesSentCount() {
111:                return bytesSentCount;
112:            }
113:
114:            public CountStatistic getBytesReceivedCount() {
115:                return bytesReceivedCount;
116:            }
117:
118:            public RangeStatistic getOpenConnectionCount() {
119:                return openConnectionCount;
120:            }
121:
122:            // TODO - Move this to container statistics
123:            public RangeStatistic getSpareThreadCount() {
124:                return null;
125:            }
126:
127:            /**
128:             * These setters are used by native implementation
129:             */
130:            public void setBytesReceivedCount(long bytesReceived) {
131:                this .bytesReceivedCount.setCount(bytesReceived);
132:            }
133:
134:            public void setBytesSentCount(long bytesSent) {
135:                this .bytesSentCount.setCount(bytesSent);
136:            }
137:
138:            public void setActiveRequestCount(int activeRequestCount) {
139:                this .activeRequestCount.setCount(activeRequestCount);
140:            }
141:
142:            public void setErrorCount(int errorCount) {
143:                this .errorCount.setCount(errorCount);
144:            }
145:
146:            public void setRequestTime(int count, long minTime, long maxTime,
147:                    long totalTime) {
148:                this .requestTime.setCount(count);
149:                this .requestTime.setMinTime(minTime);
150:                this .requestTime.setMaxTime(maxTime);
151:                this .requestTime.setTotalTime(totalTime);
152:            }
153:
154:            public void setOpenConnection(long current, long highMark,
155:                    long lowMark) {
156:                openConnectionCount.setCurrent(current);
157:                openConnectionCount.setHighWaterMark(highMark);
158:                openConnectionCount.setLowWaterMark(lowMark);
159:            }
160:
161:            public void setBusyThreads(long current, long highWaterMark,
162:                    long lowWaterMark, long upperBound, long lowerBound) {
163:                busyThreads.setCurrent(current);
164:                busyThreads.setHighWaterMark(highWaterMark);
165:                busyThreads.setLowWaterMark(lowWaterMark); //0?
166:                busyThreads.setLowerBound(lowerBound); //0?
167:                busyThreads.setUpperBound(upperBound); // always maxThreads
168:            }
169:
170:            /**
171:             * Used to access the native implementation in order to call setters
172:             * TODO implement these if needed by console
173:             */
174:            public RangeStatisticImpl getActiveRequestCountImpl() {
175:                return null;
176:            }
177:
178:            public TimeStatisticImpl getRequestDurationImpl() {
179:                return null;
180:            }
181:
182:            public CountStatisticImpl getTotalErrorCountImpl() {
183:                return null;
184:            }
185:
186:            public CountStatistic getTotalRequestCountImpl() {
187:                return null;
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.