Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1109

Expose JGroups JChannel JMX monitoring

XMLWordPrintable

      To use JGroups JChannel JMX monitoring, it's needed to register it to a MBeanServer.
      Would it be possible to add a configuration key to be able to monitor the cache at a network level ?
      Here's the actual JGroups documentation to activate JMX monitoring programmatically : http://community.jboss.org/wiki/JMX

      I guess the correct place to implements the feature should be located in org.infinispan.remoting.transport.jgroups.JGroupsTransport::startJGroupsChannelIfNeeded()
      and implementation could look like that :

      protected void startJGroupsChannelIfNeeded() {
              if (startChannel) {
                  try {
                      channel.connect(configuration.getClusterName());
                      // my first contribution M Lachance
                      ArrayList servers = MBeanServerFactory.findMBeanServer(null);
       
                      if (servers == null || servers.size() == 0) {
                          log.log(Logger.Level.WARN, "No Available MBean Servers");
                          //throw new Exception("No MBeanServers found;" +
                          //        "\nJmxTest needs to be run with an MBeanServer present, or inside JDK 5");
                      } else {
       
                          MBeanServer server = (MBeanServer) servers.get(0);
                          try {
                              if (server != null) {
                                  JmxConfigurator.registerChannel((JChannel) channel, server, "JChannel=" + channel.getChannelName(), "", true);
                              }
                          } catch (Exception e) {
       
                              log.log(Logger.Level.WARN, "Could not resgister with JMX",e);
                          }
                      }
                  } catch (ChannelException e) {
                      throw new CacheException("Unable to start JGroups Channel", e);
                  }
              }
              address = new JGroupsAddress(channel.getAddress());
              if (log.isInfoEnabled())
                  log.localAndPhysicalAddress(getAddress(), getPhysicalAddresses());
          }

      Thanks,

              rh-ee-galder Galder ZamarreƱo
              mathieu@mathieulachance.com Mathieu Lachance (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 3 hours
                  3h
                  Remaining:
                  Remaining Estimate - 3 hours
                  3h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified