Skip to content

Commit

Permalink
unregister uses hard-coded domain "jgroups" (https://jira.jboss.org/b…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Jul 6, 2010
1 parent 6803b32 commit 6a6f399
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/org/jgroups/jmx/JmxConfigurator.java
Expand Up @@ -18,7 +18,7 @@

/**
* @author Bela Ban, Vladimir Blagojevic
* @version $Id: JmxConfigurator.java,v 1.18 2010/04/05 15:24:56 vlada Exp $
* @version $Id: JmxConfigurator.java,v 1.19 2010/07/06 08:05:51 belaban Exp $
*/
public class JmxConfigurator {
static final Log log = LogFactory.getLog(JmxConfigurator.class);
Expand Down Expand Up @@ -47,7 +47,9 @@ public static void registerChannel(JChannel channel, MBeanServer server, String
ProtocolStack stack = channel.getProtocolStack();
Vector<Protocol> protocols = stack.getProtocols();
for (Protocol p : protocols) {
register(p, server, getProtocolRegistrationName(cluster_name, domain, p));
if (p.getClass().isAnnotationPresent(MBean.class)) {
register(p, server, getProtocolRegistrationName(cluster_name, domain, p));
}
}
}
register(channel, server, getChannelRegistrationName(channel, domain, cluster_name));
Expand Down Expand Up @@ -80,23 +82,28 @@ public static void unregisterChannel(MBeanServer server, String name) throws Exc
server.unregisterMBean(new ObjectName(name));
}

public static void unregisterChannel(JChannel c, MBeanServer server, String clusterName)
public static void unregisterChannel(JChannel c, MBeanServer server, String clusterName) throws Exception {
unregisterChannel(c, server, "jgroups", clusterName);
}


public static void unregisterChannel(JChannel c, MBeanServer server, String domain, String clusterName)
throws Exception {

ProtocolStack stack = c.getProtocolStack();
Vector<Protocol> protocols = stack.getProtocols();
for (Protocol p : protocols) {
if (p.getClass().isAnnotationPresent(MBean.class)) {
try {
unregister(p, server, getProtocolRegistrationName(clusterName, "jgroups", p));
unregister(p, server, getProtocolRegistrationName(clusterName, domain, p));
} catch (MBeanRegistrationException e) {
if (log.isWarnEnabled()) {
log.warn("MBean unregistration failed " + e);
}
}
}
}
unregister(c, server, getChannelRegistrationName(clusterName));
unregister(c, server, getChannelRegistrationName(c, domain, clusterName));
}

public static void registerChannelFactory(JChannelFactory factory, MBeanServer server,
Expand Down

0 comments on commit 6a6f399

Please sign in to comment.