Source Code Cross Referenced for ComponentStatistics.java in  » ESB » open-esb » com » sun » jbi » framework » 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 » ESB » open esb » com.sun.jbi.framework 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)ComponentStatistics.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package com.sun.jbi.framework;
030:
031:        import com.sun.jbi.monitoring.ComponentStatisticsBase;
032:        import com.sun.jbi.monitoring.ComponentStatisticsMBean;
033:        import com.sun.jbi.monitoring.StatisticsBase;
034:
035:        import java.util.Date;
036:        import javax.management.openmbean.CompositeData;
037:
038:        /**
039:         * This class implements the MBean for collection of statistics for a single
040:         * installed component. All statistics are since the last JBI startup; they
041:         * are all reset when JBI is restarted.
042:         *
043:         * Please note the 
044:         *
045:         * @author Sun Microsystems, Inc.
046:         */
047:        public class ComponentStatistics implements  ComponentStatisticsBase,
048:                ComponentStatisticsMBean {
049:            /**
050:             * Instance of StatisticsBase for manipulating the object tree.
051:             */
052:            private StatisticsBase mStatisticsBase;
053:
054:            /**
055:             * Time the component was last successfully started.
056:             */
057:            private Date mLastRestartTime;
058:
059:            /**
060:             * Count of calls to the life cycle init() method.
061:             */
062:            private int mInitRequests;
063:
064:            /**
065:             * Count of calls to the life cycle start() method.
066:             */
067:            private int mStartRequests;
068:
069:            /**
070:             * Count of calls to the life cycle stop() method.
071:             */
072:            private int mStopRequests;
073:
074:            /**
075:             * Count of calls to the life cycle shutDown() method.
076:             */
077:            private int mShutDownRequests;
078:
079:            /**
080:             * Count of calls to life cycle methods that resulted in exceptions.
081:             */
082:            private int mFailedRequests;
083:
084:            /**
085:             * Count of calls to life cycle methods that timed out.
086:             */
087:            private int mTimedOutRequests;
088:
089:            /**
090:             * Number of Service Units currently deployed.
091:             */
092:            private short mDeployedSUs;
093:
094:            /**
095:             * Count of calls to the ServiceUnitManager deploy() method.
096:             */
097:            private int mDeploySURequests;
098:
099:            /**
100:             * Count of calls to the ServiceUnitManager init() method.
101:             */
102:            private int mInitSURequests;
103:
104:            /**
105:             * Count of calls to the ServiceUnitManager start() method.
106:             */
107:            private int mStartSURequests;
108:
109:            /**
110:             * Count of calls to the ServiceUnitManager stop() method.
111:             */
112:            private int mStopSURequests;
113:
114:            /**
115:             * Count of calls to the ServiceUnitManager shutDown() method.
116:             */
117:            private int mShutDownSURequests;
118:
119:            /**
120:             * Count of calls to the ServiceUnitManager undeploy() method.
121:             */
122:            private int mUndeploySURequests;
123:
124:            /**
125:             * Count of calls to ServiceUnitManager methods that resulted in exceptions.
126:             */
127:            private int mFailedSURequests;
128:
129:            /**
130:             * Count of calls to ServiceUnitManager methods that timed out.
131:             */
132:            private int mTimedOutSURequests;
133:
134:            /**
135:             * Count of current number of services or endpoints registered with NMR.
136:             */
137:            private short mRegisteredServicesOrEndpoints;
138:
139:            /**
140:             * Constant used to compute percentages.
141:             */
142:            private static final int ONE_HUNDRED = 100;
143:
144:            /**
145:             * Constant used to compute rates.
146:             */
147:            private static final int MILLISECONDS_PER_HOUR = 3600000;
148:
149:            /**
150:             * Constructor to create the StatisticsBase and MessagingStatistics
151:             * instances.
152:             * @param key the component name used as the key for the StatisticsBase.
153:             */
154:            public ComponentStatistics(String key) {
155:                mStatisticsBase = new com.sun.jbi.util.monitoring.StatisticsBaseImpl(
156:                        key);
157:            }
158:
159:            //
160:            // Methods defined in StatisticsMBean must delegate to StatisticsBase.
161:            //
162:
163:            /**
164:             * Test whether or not statistics collection is enabled.
165:             * @return true if statistics collection is enabled, false if not.
166:             */
167:            public boolean isEnabled() {
168:                return mStatisticsBase.isEnabled();
169:            }
170:
171:            /**
172:             * Disable statistics collection. This method causes collection for this
173:             * object and all its child objects to be disabled.
174:             */
175:            public void setDisabled() {
176:                mStatisticsBase.setDisabled();
177:            }
178:
179:            /**
180:             * Enable statistics collection. This method causes collection for this
181:             * object and all its child objects to be enabled.
182:             */
183:            public void setEnabled() {
184:                mStatisticsBase.setEnabled();
185:            }
186:
187:            //
188:            // Methods defined in the ComponentStatisticsBase interface. These
189:            // methods can be called from outside the framework, and are used by
190:            // the NMR instrumentation code.
191:            //
192:
193:            /**
194:             * Get the StatisticsBase instance.
195:             * @return the StatisticsBase instance for this object.
196:             */
197:            public StatisticsBase getStatisticsBase() {
198:                return mStatisticsBase;
199:            }
200:
201:            /**
202:             * Decrement the current number of services or endpoints registered with
203:             * the NMR.
204:             */
205:            public void decrementRegisteredServicesOrEndpoints() {
206:                --mRegisteredServicesOrEndpoints;
207:            }
208:
209:            /**
210:             * Increment the current number of services or endpoints registered with
211:             * the NMR.
212:             */
213:            public void incrementRegisteredServicesOrEndpoints() {
214:                ++mRegisteredServicesOrEndpoints;
215:            }
216:
217:            //
218:            // Methods defined in the ComponentStatisticsMBean interface. These
219:            // methods provide all the MBean attributes visible to JMX clients.
220:            //
221:
222:            /**
223:             * Get the time that this component was last started.
224:             * @return The time of the last successful start() call.
225:             */
226:            public Date getLastRestartTime() {
227:                return mLastRestartTime;
228:            }
229:
230:            /**
231:             * Get the count of calls to the life cycle init() method.
232:             * @return The total number of calls to init().
233:             */
234:            public int getInitRequests() {
235:                return mInitRequests;
236:            }
237:
238:            /**
239:             * Get the count of calls to the life cycle start() method.
240:             * @return The total number of calls to start().
241:             */
242:            public int getStartRequests() {
243:                return mStartRequests;
244:            }
245:
246:            /**
247:             * Get the count of calls to the life cycle stop() method.
248:             * @return The total number of calls to stop().
249:             */
250:            public int getStopRequests() {
251:                return mStopRequests;
252:            }
253:
254:            /**
255:             * Get the count of calls to the life cycle shutDown() method.
256:             * @return The total number of calls to shutDown().
257:             */
258:            public int getShutDownRequests() {
259:                return mShutDownRequests;
260:            }
261:
262:            /**
263:             * Get the count of failed calls to life cycle methods (excluding timeouts).
264:             * @return The total number of failed calls.
265:             */
266:            public int getFailedRequests() {
267:                return mFailedRequests;
268:            }
269:
270:            /**
271:             * Get the count of timed out calls to life cycle methods.
272:             * @return The total number of timed out calls.
273:             */
274:            public int getTimedOutRequests() {
275:                return mTimedOutRequests;
276:            }
277:
278:            /**
279:             * Get the current number of Service Units deployed.
280:             * @return The current number of deployed SUs.
281:             */
282:            public short getDeployedSUs() {
283:                return mDeployedSUs;
284:            }
285:
286:            /**
287:             * Get the count of calls to the ServiceUnitManager deploy() method.
288:             * @return The total number of calls to deploy().
289:             */
290:            public int getDeploySURequests() {
291:                return mDeploySURequests;
292:            }
293:
294:            /**
295:             * Get the count of calls to the ServiceUnitManager undeploy() method.
296:             * @return The total number of calls to undeploy().
297:             */
298:            public int getUndeploySURequests() {
299:                return mUndeploySURequests;
300:            }
301:
302:            /**
303:             * Get the count of calls to the ServiceUnitManager init() method.
304:             * @return The total number of calls to init().
305:             */
306:            public int getInitSURequests() {
307:                return mInitSURequests;
308:            }
309:
310:            /**
311:             * Get the count of calls to the ServiceUnitManager start() method.
312:             * @return The total number of calls to start().
313:             */
314:            public int getStartSURequests() {
315:                return mStartSURequests;
316:            }
317:
318:            /**
319:             * Get the count of calls to the ServiceUnitManager stop() method.
320:             * @return The total number of calls to stop().
321:             */
322:            public int getStopSURequests() {
323:                return mStopSURequests;
324:            }
325:
326:            /**
327:             * Get the count of calls to the ServiceUnitManager shutDown() method.
328:             * @return The total number of calls to shutDown().
329:             */
330:            public int getShutDownSURequests() {
331:                return mShutDownSURequests;
332:            }
333:
334:            /**
335:             * Get the count of failed calls to ServiceUnitManager methods (excluding
336:             * timeouts).
337:             * @return The total number of failed calls.
338:             */
339:            public int getFailedSURequests() {
340:                return mFailedSURequests;
341:            }
342:
343:            /**
344:             * Get the count of timed out calls to ServiceUnitManager methods.
345:             * @return The total number of timed out calls.
346:             */
347:            public int getTimedOutSURequests() {
348:                return mTimedOutSURequests;
349:            }
350:
351:            /**
352:             * Get the current number of services (for an SE) or endpoint (for a BC)
353:             * registered with the NMR.
354:             * @return The total number of registered services or endpoints.
355:             */
356:            public short getRegisteredServicesOrEndpoints() {
357:                return mRegisteredServicesOrEndpoints;
358:            }
359:
360:            //
361:            // Methods used only within the framework code to update framework-
362:            // provided statistics.
363:            //
364:
365:            /**
366:             * Set the time that this component was last started.
367:             * @param startTime The time of the last successful start() call.
368:             */
369:            void setLastRestartTime(Date startTime) {
370:                mLastRestartTime = startTime;
371:            }
372:
373:            /**
374:             * Increment the count of calls to the life cycle init() method.
375:             */
376:            void incrementInitRequests() {
377:                ++mInitRequests;
378:            }
379:
380:            /**
381:             * Increment the count of calls to the life cycle start() method.
382:             */
383:            void incrementStartRequests() {
384:                ++mStartRequests;
385:            }
386:
387:            /**
388:             * Increment the count of calls to the life cycle stop() method.
389:             */
390:            void incrementStopRequests() {
391:                ++mStopRequests;
392:            }
393:
394:            /**
395:             * Increment the count of calls to the life cycle shutDown() method.
396:             */
397:            void incrementShutDownRequests() {
398:                ++mShutDownRequests;
399:            }
400:
401:            /**
402:             * Increment the count of failed calls to life cycle methods (excluding
403:             * timeouts).
404:             */
405:            void incrementFailedRequests() {
406:                ++mFailedRequests;
407:            }
408:
409:            /**
410:             * Increment the count of timed out calls to life cycle methods.
411:             */
412:            void incrementTimedOutRequests() {
413:                ++mTimedOutRequests;
414:            }
415:
416:            /**
417:             * Decrement the current number of Service Units deployed.
418:             */
419:            void decrementDeployedSUs() {
420:                --mDeployedSUs;
421:            }
422:
423:            /**
424:             * Increment the current number of Service Units deployed.
425:             */
426:            void incrementDeployedSUs() {
427:                ++mDeployedSUs;
428:            }
429:
430:            /**
431:             * Increment the count of calls to the ServiceUnitManager deploy() method.
432:             */
433:            void incrementDeploySURequests() {
434:                ++mDeploySURequests;
435:            }
436:
437:            /**
438:             * Increment the count of calls to the ServiceUnitManager undeploy() method.
439:             */
440:            void incrementUndeploySURequests() {
441:                ++mUndeploySURequests;
442:            }
443:
444:            /**
445:             * Increment the count of calls to the ServiceUnitManager init() method.
446:             */
447:            void incrementInitSURequests() {
448:                ++mInitSURequests;
449:            }
450:
451:            /**
452:             * Increment the count of calls to the ServiceUnitManager start() method.
453:             */
454:            void incrementStartSURequests() {
455:                ++mStartSURequests;
456:            }
457:
458:            /**
459:             * Increment the count of calls to the ServiceUnitManager stop() method.
460:             */
461:            void incrementStopSURequests() {
462:                ++mStopSURequests;
463:            }
464:
465:            /**
466:             * Increment the count of calls to the ServiceUnitManager shutDown() method.
467:             */
468:            void incrementShutDownSURequests() {
469:                ++mShutDownSURequests;
470:            }
471:
472:            /**
473:             * Increment the count of failed calls to ServiceUnitManager methods
474:             * (excluding timeouts).
475:             */
476:            void incrementFailedSURequests() {
477:                ++mFailedSURequests;
478:            }
479:
480:            /**
481:             * Increment the count of timed out calls to ServiceUnitManager methods.
482:             */
483:            void incrementTimedOutSURequests() {
484:                ++mTimedOutSURequests;
485:            }
486:
487:            /**
488:             * Reset all statistics.
489:             */
490:            void resetAllStatistics() {
491:                resetFrameworkStatistics();
492:            }
493:
494:            /**
495:             * Reset framework statistics. Note that the last restart time of the
496:             * component is not reset, this is always preserved until the next restart
497:             * of the component.
498:             */
499:            void resetFrameworkStatistics() {
500:                mInitRequests = 0;
501:                mStartRequests = 0;
502:                mStopRequests = 0;
503:                mShutDownRequests = 0;
504:                mFailedRequests = 0;
505:                mTimedOutRequests = 0;
506:                mDeployedSUs = 0;
507:                mDeploySURequests = 0;
508:                mInitSURequests = 0;
509:                mStartSURequests = 0;
510:                mStopSURequests = 0;
511:                mShutDownSURequests = 0;
512:                mUndeploySURequests = 0;
513:                mFailedSURequests = 0;
514:                mTimedOutSURequests = 0;
515:                mRegisteredServicesOrEndpoints = 0;
516:            }
517:
518:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.