View Javadoc

1   /*
2    * $Id: FlowConstructStats.java 20320 2010-11-24 15:03:31Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.module.management.mbean;
11  
12  import org.apache.commons.logging.Log;
13  import org.apache.commons.logging.LogFactory;
14  import org.mule.management.stats.FlowConstructStatistics;
15  
16  import javax.management.MBeanRegistration;
17  import javax.management.MBeanServer;
18  import javax.management.ObjectName;
19  
20  /**
21   * A concrete class that holds management information for a Mule managed flow.
22   */
23  public class FlowConstructStats implements FlowConstructStatsMBean, MBeanRegistration
24  {
25      private final FlowConstructStatistics statistics;
26  
27  
28      protected MBeanServer server;
29  
30      protected ObjectName name;
31  
32      /**
33       * logger used by this class
34       */
35      private static Log LOGGER = LogFactory.getLog(FlowConstructStats.class);
36  
37      public FlowConstructStats(FlowConstructStatistics statistics)
38      {
39          this.statistics = statistics;
40      }
41  
42      public long getAverageProcessingTime()
43      {
44          return statistics.getAverageProcessingTime();
45      }
46  
47      public long getProcessedEvents()
48      {
49          return statistics.getProcessedEvents();
50      }
51  
52      public long getMaxProcessingTime()
53      {
54          return statistics.getMaxProcessingTime();
55      }
56  
57      public long getMinProcessingTime()
58      {
59          return statistics.getMinProcessingTime();
60      }
61  
62      public long getTotalProcessingTime()
63      {
64          return statistics.getTotalProcessingTime();
65      }
66  
67      public void clearStatistics()
68      {
69          statistics.clear();
70      }
71  
72      public long getAsyncEventsReceived()
73      {
74          return statistics.getAsyncEventsReceived();
75      }
76  
77      public long getSyncEventsReceived()
78      {
79          return statistics.getSyncEventsReceived();
80      }
81  
82      public long getTotalEventsReceived()
83      {
84          return statistics.getTotalEventsReceived();
85      }
86  
87      public long getExecutionErrors()
88      {
89          return statistics.getExecutionErrors();
90      }
91  
92      public long getFatalErrors()
93      {
94          return statistics.getFatalErrors();
95      }
96  
97      public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
98      {
99          this.server = server;
100         this.name = name;
101         return name;
102     }
103 
104     public void postRegister(Boolean registrationDone)
105     {
106         // nothing to do
107     }
108 
109     public void preDeregister() throws Exception
110     {
111         // nothing to do
112     }
113 
114     public void postDeregister()
115     {
116         // nothing to do
117     }
118 }