[jboss-cvs] JBossCache/src/org/jboss/cache/util ...
Manik Surtani
msurtani at jboss.com
Wed Sep 6 10:45:41 EDT 2006
User: msurtani
Date: 06/09/06 10:45:41
Modified: src/org/jboss/cache/util MBeanConfigurator.java
Log:
fixed JMX tests, added more JMX tests
Revision Changes Path
1.8 +47 -46 JBossCache/src/org/jboss/cache/util/MBeanConfigurator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MBeanConfigurator.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/util/MBeanConfigurator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- MBeanConfigurator.java 19 Jul 2006 21:34:45 -0000 1.7
+++ MBeanConfigurator.java 6 Sep 2006 14:45:41 -0000 1.8
@@ -30,14 +30,15 @@
/**
* JBoss cache management configurator
+ *
* @author Jerry Gauthier
- * @version $Id: MBeanConfigurator.java,v 1.7 2006/07/19 21:34:45 msurtani Exp $
+ * @version $Id: MBeanConfigurator.java,v 1.8 2006/09/06 14:45:41 msurtani Exp $
*/
public class MBeanConfigurator
{
- private static final String MBEAN_CLASS_SUFFIX = "MBean";
- private static final String MBEAN_KEY = ",treecache-interceptor=";
- private static final String PREFIX = "jboss.cache:service=";
+ public static final String MBEAN_CLASS_SUFFIX = "MBean";
+ public static final String MBEAN_KEY = ",treecache-interceptor=";
+ public static final String PREFIX = "jboss.cache:service=";
/*
* Register the associated mbeans for cache interceptors
@@ -56,11 +57,11 @@
Interceptor interceptor = null;
// get the cache's registration name
- String tmpName = cache.getServiceName() != null? cache.getServiceName().toString() : null;
- if(tmpName == null)
+ String tmpName = cache.getServiceName() != null ? cache.getServiceName().toString() : null;
+ if (tmpName == null)
{
tmpName = PREFIX + cache.getConfiguration().getClusterName();
- if(cache.getConfiguration().getClusterName() == null)
+ if (cache.getConfiguration().getClusterName() == null)
tmpName = PREFIX + cache.getClass().getName() + System.currentTimeMillis();
}
// register the cache
@@ -68,19 +69,19 @@
{
ObjectName tmpObj = new ObjectName(tmpName);
if (!server.isRegistered(tmpObj))
- server.registerMBean(cache, tmpObj);
+ server.registerMBean(cache.getCacheMBeanInterface(), tmpObj);
}
- for(int i = 0; i < interceptors.size(); i++)
+ for (int i = 0; i < interceptors.size(); i++)
{
- interceptor =(Interceptor)interceptors.get(i);
+ interceptor = (Interceptor) interceptors.get(i);
boolean mbeanExists = true;
try
{
// the mbean for interceptor AbcInterceptor will be named AbcInterceptorMBean
- Class.forName(interceptor.getClass().getName()+ MBEAN_CLASS_SUFFIX);
+ Class.forName(interceptor.getClass().getName() + MBEAN_CLASS_SUFFIX);
}
- catch(Throwable e)
+ catch (Throwable e)
{
// if the class can't be instantiated, no mbean is available
mbeanExists = false;
@@ -89,7 +90,7 @@
// for JDK 1.4, must parse name and remove package prefix
// for JDK 1.5, can use getSimpleName() to establish class name without package prefix
String className = interceptor.getClass().getName();
- String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.')+1);
+ String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.') + 1);
ObjectName objName = new ObjectName(serviceName);
if (!server.isRegistered(objName))
@@ -121,22 +122,22 @@
Interceptor interceptor = null;
// get the cache's registration name
- String tmpName = cache.getServiceName() != null? cache.getServiceName().toString() : null;
- if(tmpName == null)
+ String tmpName = cache.getServiceName() != null ? cache.getServiceName().toString() : null;
+ if (tmpName == null)
{
tmpName = PREFIX + cache.getConfiguration().getClusterName();
- if(cache.getConfiguration().getClusterName() == null)
+ if (cache.getConfiguration().getClusterName() == null)
tmpName = PREFIX + cache.getClass().getName() + System.currentTimeMillis();
}
- for(int i = 0; i < interceptors.size(); i++)
+ for (int i = 0; i < interceptors.size(); i++)
{
- interceptor =(Interceptor)interceptors.get(i);
+ interceptor = (Interceptor) interceptors.get(i);
// for JDK 1.4, must parse name and remove package prefix
// for JDK 1.5, can use getSimpleName() to establish class name without package prefix
String className = interceptor.getClass().getName();
- String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.')+1);
+ String serviceName = tmpName + MBEAN_KEY + className.substring(className.lastIndexOf('.') + 1);
ObjectName objName = new ObjectName(serviceName);
if (server.isRegistered(objName))
More information about the jboss-cvs-commits
mailing list