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