code: public static void registerChannel(JChannel channel, MBeanServer server, String domain,
                      String cluster_name, boolean register_protocols) throws Exception {
  
          if(channel == null)
              throw new NullPointerException("channel cannot be null");
          if (cluster_name == null)
              cluster_name=channel.getClusterName();
          if (cluster_name == null)
              cluster_name = "null";
  
          cluster_name=ObjectName.quote(cluster_name);
  
          if (register_protocols) {
              ProtocolStack stack = channel.getProtocolStack();
              List<Protocol> protocols = stack.getProtocols();
              for (Protocol p : protocols) {
                  if (p.getClass().isAnnotationPresent(MBean.class)) {
                      String jmx_name=getProtocolRegistrationName(cluster_name,domain,p);
                      register(p, server, jmx_name);
                  }
              }
          }
          register(channel, server, getChannelRegistrationName(channel, domain, cluster_name));
      }
docs: Registers an already created channel with the given MBeanServer. Wraps instance of JChannel
  with DynamicMBean and delegates all calls to the actual JChannel wrapped.
  <p>
  Optionally, this method will also wrap each protocol in the given channel with DynamicMBean
  and register it as well.
  
  @param channel
  @param server
  @param domain
  Has to be a JMX ObjectName of the domain, e.g. DefaultDomain:name=JGroups
  @param register_protocols