[jbosscache-commits] JBoss Cache SVN: r5654 - in core/trunk/src: test/java/org/jboss/cache/jmx and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Apr 24 05:41:31 EDT 2008


Author: mircea.markus
Date: 2008-04-24 05:41:31 -0400 (Thu, 24 Apr 2008)
New Revision: 5654

Modified:
   core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
   core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
Log:
JBCACHE-1222 - fixed JMX config

Modified: core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java	2008-04-24 09:20:40 UTC (rev 5653)
+++ core/trunk/src/main/java/org/jboss/cache/factories/InterceptorChainFactory.java	2008-04-24 09:41:31 UTC (rev 5654)
@@ -35,17 +35,19 @@
 
    private ChainedInterceptor createInterceptor(Class<? extends ChainedInterceptor> clazz) throws IllegalAccessException, InstantiationException
    {
-      ChainedInterceptor i = componentRegistry.getComponent(clazz.getName(), clazz);
-      if (i == null)
+      //todo - no reason for the individual interceptors to be registered as components, all manipulation should be done through InterceptorChain
+      ChainedInterceptor chainedInterceptor = componentRegistry.getComponent(clazz.getName(), clazz);
+      if (chainedInterceptor == null)
       {
-         i = clazz.newInstance();
-         componentRegistry.registerComponent(clazz.getName(), i, clazz);
+         chainedInterceptor = clazz.newInstance();
+         componentRegistry.registerComponent(clazz.getName(), chainedInterceptor, clazz);
       } else
       {
          // wipe next/last chaining!!
-         i.setNext(null);
+         chainedInterceptor.setNext(null);
       }
-      return i;
+      chainedInterceptor.setStatisticsEnabled(configuration.getExposeManagementStatistics());
+      return chainedInterceptor;
    }
 
    public InterceptorChain buildInterceptorChain() throws IllegalAccessException, InstantiationException, ClassNotFoundException

Modified: core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java	2008-04-24 09:20:40 UTC (rev 5653)
+++ core/trunk/src/test/java/org/jboss/cache/jmx/CacheJmxWrapperTest.java	2008-04-24 09:41:31 UTC (rev 5654)
@@ -39,12 +39,11 @@
    public void testSetCacheObjectName() throws Exception
    {
       ObjectName on = new ObjectName("jboss.cache:test=SetCacheObjectName");
-      String str = on.getCanonicalName();
       boolean registered = false;
       try
       {
          CacheJmxWrapper<String, String> wrapper = createWrapper(createConfiguration());
-         wrapper.setCacheObjectName(str);
+         wrapper.setCacheObjectName(on.getCanonicalName());
 
          // Register under the standard name
          registerWrapper(wrapper);
@@ -52,12 +51,12 @@
          registered = mBeanServer.isRegistered(on);
 
          assertTrue("Registered with configured name", registered);
-         assertEquals("Configured name retained", str, wrapper.getCacheObjectName());
+         assertEquals("Configured name retained", on.getCanonicalName(), wrapper.getCacheObjectName());
 
          wrapper.create();
          wrapper.start();
 
-         interceptorRegistrationTest(str, true);
+         interceptorRegistrationTest(on.getCanonicalName(), true);
 
          wrapper.stop();
          wrapper.destroy();




More information about the jbosscache-commits mailing list