Source Code Cross Referenced for ServiceStats.java in  » ESB » mule » org » mule » module » management » mbean » 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 » mule » org.mule.module.management.mbean 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ServiceStats.java 11234 2008-03-06 23:44:34Z tcarlson $
003:         * --------------------------------------------------------------------------------------
004:         * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
005:         *
006:         * The software in this package is published under the terms of the CPAL v1.0
007:         * license, a copy of which has been included with this distribution in the
008:         * LICENSE.txt file.
009:         */
010:
011:        package org.mule.module.management.mbean;
012:
013:        import org.mule.management.stats.ServiceStatistics;
014:        import org.mule.management.stats.RouterStatistics;
015:
016:        import javax.management.MBeanRegistration;
017:        import javax.management.MBeanServer;
018:        import javax.management.ObjectName;
019:
020:        import org.apache.commons.logging.Log;
021:        import org.apache.commons.logging.LogFactory;
022:
023:        /**
024:         * <code>ServiceStats</code> TODO
025:         */
026:        public class ServiceStats implements  ServiceStatsMBean,
027:                MBeanRegistration {
028:
029:            /**
030:             * logger used by this class
031:             */
032:            private static Log LOGGER = LogFactory.getLog(ServiceStats.class);
033:
034:            private MBeanServer server;
035:
036:            private ObjectName name;
037:            private ObjectName inboundName;
038:            private ObjectName outboundName;
039:
040:            private ServiceStatistics statistics;
041:
042:            public ServiceStats(ServiceStatistics statistics) {
043:                this .statistics = statistics;
044:            }
045:
046:            /**
047:             * 
048:             */
049:            public void clearStatistics() {
050:                statistics.clear();
051:            }
052:
053:            /**
054:             * @return
055:             */
056:            public long getAsyncEventsReceived() {
057:                return statistics.getAsyncEventsReceived();
058:            }
059:
060:            /**
061:             * @return
062:             */
063:            public long getAsyncEventsSent() {
064:                return statistics.getAsyncEventsSent();
065:            }
066:
067:            /**
068:             * @return
069:             */
070:            public long getAverageExecutionTime() {
071:                return statistics.getAverageExecutionTime();
072:            }
073:
074:            /**
075:             * @return
076:             */
077:            public long getAverageQueueSize() {
078:                return statistics.getAverageQueueSize();
079:            }
080:
081:            /**
082:             * @return
083:             */
084:            public long getExecutedEvents() {
085:                return statistics.getExecutedEvents();
086:            }
087:
088:            /**
089:             * @return
090:             */
091:            public long getExecutionErrors() {
092:                return statistics.getExecutionErrors();
093:            }
094:
095:            /**
096:             * @return
097:             */
098:            public long getFatalErrors() {
099:                return statistics.getFatalErrors();
100:            }
101:
102:            /**
103:             * @return
104:             */
105:            public long getMaxExecutionTime() {
106:                return statistics.getMaxExecutionTime();
107:            }
108:
109:            /**
110:             * @return
111:             */
112:            public long getMaxQueueSize() {
113:                return statistics.getMaxQueueSize();
114:            }
115:
116:            /**
117:             * @return
118:             */
119:            public long getMinExecutionTime() {
120:                return statistics.getMinExecutionTime();
121:            }
122:
123:            /**
124:             * @return
125:             */
126:            public String getName() {
127:                return statistics.getName();
128:            }
129:
130:            /**
131:             * @return
132:             */
133:            public long getQueuedEvents() {
134:                return statistics.getQueuedEvents();
135:            }
136:
137:            /**
138:             * @return
139:             */
140:            public long getReplyToEventsSent() {
141:                return statistics.getReplyToEventsSent();
142:            }
143:
144:            /**
145:             * @return
146:             */
147:            public long getSyncEventsReceived() {
148:                return statistics.getSyncEventsReceived();
149:            }
150:
151:            /**
152:             * @return
153:             */
154:            public long getSyncEventsSent() {
155:                return statistics.getSyncEventsSent();
156:            }
157:
158:            /**
159:             * @return
160:             */
161:            public long getTotalEventsReceived() {
162:                return statistics.getTotalEventsReceived();
163:            }
164:
165:            /**
166:             * @return
167:             */
168:            public long getTotalEventsSent() {
169:                return statistics.getTotalEventsSent();
170:            }
171:
172:            /**
173:             * @return
174:             */
175:            public long getTotalExecutionTime() {
176:                return statistics.getTotalExecutionTime();
177:            }
178:
179:            /*
180:             * (non-Javadoc)
181:             * 
182:             * @see javax.management.MBeanRegistration#preRegister(javax.management.MBeanServer,
183:             *      javax.management.ObjectName)
184:             */
185:            public ObjectName preRegister(MBeanServer server, ObjectName name)
186:                    throws Exception {
187:                this .server = server;
188:                this .name = name;
189:                return name;
190:            }
191:
192:            /*
193:             * (non-Javadoc)
194:             * 
195:             * @see javax.management.MBeanRegistration#postRegister(java.lang.Boolean)
196:             */
197:            public void postRegister(Boolean registrationDone) {
198:
199:                try {
200:                    RouterStatistics is = this .statistics
201:                            .getInboundRouterStat();
202:                    if (is != null) {
203:                        inboundName = new ObjectName(name.getDomain()
204:                                + ":type=org.mule.Statistics,service="
205:                                + statistics.getName() + ",router=inbound");
206:                        // unregister old version if exists
207:                        if (this .server.isRegistered(inboundName)) {
208:                            this .server.unregisterMBean(inboundName);
209:                        }
210:                        this .server.registerMBean(new RouterStats(is),
211:                                this .inboundName);
212:                    }
213:                    RouterStatistics os = this .statistics
214:                            .getOutboundRouterStat();
215:                    if (os != null) {
216:                        outboundName = new ObjectName(name.getDomain()
217:                                + ":type=org.mule.Statistics,service="
218:                                + statistics.getName() + ",router=outbound");
219:                        // unregister old version if exists
220:                        if (this .server.isRegistered(outboundName)) {
221:                            this .server.unregisterMBean(outboundName);
222:                        }
223:                        this .server.registerMBean(new RouterStats(os),
224:                                this .outboundName);
225:                    }
226:                } catch (Exception e) {
227:                    LOGGER.error("Error post-registering MBean", e);
228:                }
229:
230:            }
231:
232:            /*
233:             * (non-Javadoc)
234:             * 
235:             * @see javax.management.MBeanRegistration#preDeregister()
236:             */
237:            public void preDeregister() throws Exception {
238:                // nothing to do
239:            }
240:
241:            /*
242:             * (non-Javadoc)
243:             * 
244:             * @see javax.management.MBeanRegistration#postDeregister()
245:             */
246:            public void postDeregister() {
247:                try {
248:                    if (this .server.isRegistered(inboundName)) {
249:                        this .server.unregisterMBean(inboundName);
250:                    }
251:                } catch (Exception ex) {
252:                    LOGGER.error("Error unregistering ServiceStats child "
253:                            + inboundName.getCanonicalName(), ex);
254:                }
255:                try {
256:                    if (this .server.isRegistered(outboundName)) {
257:                        this .server.unregisterMBean(outboundName);
258:                    }
259:                } catch (Exception ex) {
260:                    LOGGER.error("Error unregistering ServiceStats child "
261:                            + inboundName.getCanonicalName(), ex);
262:                }
263:            }
264:
265:            /*
266:             * (non-Javadoc)
267:             * 
268:             * @see org.mule.management.mbeans.ServiceStatsMBean#getInboundRouter()
269:             */
270:            public ObjectName getRouterInbound() {
271:                return this .inboundName;
272:            }
273:
274:            /*
275:             * (non-Javadoc)
276:             * 
277:             * @see org.mule.management.mbeans.ServiceStatsMBean#getOutboundRouter()
278:             */
279:            public ObjectName getRouterOutbound() {
280:                return this.outboundName;
281:            }
282:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.