1
2
3
4
5
6
7 package org.mule.module.management.mbean;
8
9 import org.mule.api.MuleContext;
10 import org.mule.management.stats.FlowConstructStatistics;
11
12 import org.apache.commons.logging.Log;
13 import org.apache.commons.logging.LogFactory;
14
15
16
17
18 public class ApplicationService extends FlowConstructService implements FlowConstructServiceMBean
19 {
20 private static Log LOGGER = LogFactory.getLog(ApplicationService.class);
21
22 public ApplicationService(String type, String name, MuleContext muleContext, FlowConstructStatistics statistics)
23 {
24 super(type, name, muleContext, statistics);
25 }
26
27 @Override
28 public void postRegister(Boolean registrationDone)
29 {
30 try
31 {
32 statsName = jmxSupport.getObjectName(String.format("%s:type=org.mule.Statistics,%s=%s", objectName.getDomain(),
33 statistics.getFlowConstructType(), jmxSupport.escape(getName())));
34
35
36 if (this.server.isRegistered(statsName))
37 {
38 this.server.unregisterMBean(statsName);
39 }
40
41 this.server.registerMBean(new FlowConstructStats(statistics), this.statsName);
42 }
43 catch (Exception e)
44 {
45 LOGGER.error("Error post-registering the MBean", e);
46 }
47 }
48 }