[jbosscache-commits] JBoss Cache SVN: r7201 - core/trunk/src/main/java/org/jboss/cache/jmx.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Wed Nov 26 15:35:07 EST 2008


Author: manik.surtani at jboss.com
Date: 2008-11-26 15:35:07 -0500 (Wed, 26 Nov 2008)
New Revision: 7201

Modified:
   core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
Log:
JBCACHE-1444  ObjectName's validation fails for Jbosscache 3.0 on WAS 6.1 due to ":" char in name

Modified: core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java	2008-11-26 20:27:59 UTC (rev 7200)
+++ core/trunk/src/main/java/org/jboss/cache/jmx/JmxRegistrationManager.java	2008-11-26 20:35:07 UTC (rev 7201)
@@ -29,7 +29,10 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.factories.ComponentRegistry;
 
-import javax.management.*;
+import javax.management.InstanceAlreadyExistsException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
 import java.util.List;
@@ -42,23 +45,34 @@
  * is being used.
  * <p/>
  * It is immutable: both cache instance and MBeanServer are being passed as arguments to the constructor.
+ * <p />
+ * <p>
+ * Note that by default object names used are prefixed with <tt>jboss.cache:service=JBossCache</tt>.  While this format
+ * works for and is consistent with JBoss AS and the JMX console, it has been known to cause problems with other JMX
+ * servers such as Websphere.  To work around this, you can provide the following VM system property to override this
+ * prefix with a prefix of your choice:
+ * <tt><b>-Djbosscache.jmx.prefix=JBossCache</b></tt>
+ * </p>
  *
  * @author Mircea.Markus at jboss.com
  * @since 3.0
  */
 public class JmxRegistrationManager
 {
+
    private static final Log log = LogFactory.getLog(JmxRegistrationManager.class);
 
+   private static final String GENERAL_PREFIX = System.getProperty("jbosscache.jmx.prefix", "jboss.cache:service=JBossCache");
+
    /**
     * default ObjectName for clusterd caches. Cluster name should pe appended.
     */
-   public static final String REPLICATED_CACHE_PREFIX = "jboss.cache:service=JBossCache,cluster=";
+   public static final String REPLICATED_CACHE_PREFIX = GENERAL_PREFIX + ",cluster=";
 
    /**
     * default ObjectName for non clustered caches. An unique identifier should be appended.
     */
-   public static final String LOCAL_CACHE_PREFIX = "jboss.cache:service=JBossCache,uniqueId=";
+   public static final String LOCAL_CACHE_PREFIX = GENERAL_PREFIX + ",uniqueId=";
 
    /**
     * Key for every Dynamic mbean added.
@@ -198,7 +212,7 @@
          return;
       }
       if (cacheSpi.getConfiguration().getCacheMode().equals(Configuration.CacheMode.LOCAL))
-      {         
+      {
          // CurrentTimeMillis is not good enaugh as an unique id generator. I am constantly
          // getting conflicts in several parallel tests on my box. Maybe some more sofisticated
          // unique id generator should be provided?




More information about the jbosscache-commits mailing list