Package org.jboss.cache.jmx

Examples of org.jboss.cache.jmx.CacheJmxWrapper


    */
   private void initializeCache() throws Exception
   {
      if (plainCache == null) {
        
         CacheJmxWrapper pcWrapper = null;
         MBeanServer server = tomcatConfig.getMBeanServer();
         String cfgName = tomcatConfig.getCacheObjectName();
         ObjectName objName = cfgName == null ? null : new ObjectName(tomcatConfig.getCacheObjectName());
         if (server != null && objName != null && server.isRegistered(objName))
         {
            // Get a proxy to the existing TreeCache
            pcWrapper = ((CacheJmxWrapper)
                           MBeanServerInvocationHandler.newProxyInstance(server, objName, CacheJmxWrapper.class, false));
         }
         else
         {
            // See if there is an XML descriptor file to configure the cache
            File configFile = tomcatConfig.getCacheConfigFile();
            String clusterName = tomcatConfig.getClusterName();
           
            if (configFile != null)
            {
               pcWrapper = new CacheJmxWrapper(DefaultCacheFactory.getInstance().createCache(configFile.getAbsolutePath(), false));
                             
               if (clusterName != null)
               {
                  // Override the XML config with the name provided in
                  // server.xml.  Method setClusterName is specified in the
                  // Cluster interface, otherwise we would not do this
                  pcWrapper.getCache().getConfiguration().setClusterName(clusterName);
               }
            }
            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
               pcWrapper = new CacheJmxWrapper(DefaultCacheFactory.getInstance().createCache(config, false));

            }
           
            if (server != null && objName != null)
            {
               server.registerMBean(pcWrapper, objName);
            }
           
            cacheLocal = true;
         }
         setPlainCache(pcWrapper.getCache());
      }
   }
View Full Code Here


public class LegacyConfigurationTest extends CacheJmxWrapperTestBase
{
   @SuppressWarnings({"deprecation", "unchecked"})
   public void testLocalCache() throws Exception
   {
      CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper();
      registerWrapper(wrapper);

      wrapper = (CacheJmxWrapperMBean<String, String>) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);

      wrapper.setBuddyReplicationConfig(getBuddyReplicationConfig());
      wrapper.setCacheLoaderConfig(getCacheLoaderConfig());
      wrapper.setCacheMode("REPL_SYNC");
      wrapper.setClusterName("LocalTest");
      wrapper.setClusterConfig(getClusterConfig());
      wrapper.setEvictionPolicyConfig(getEvictionPolicyConfig());
      wrapper.setFetchInMemoryState(false);
      wrapper.setInitialStateRetrievalTimeout(100);
      wrapper.setInactiveOnStartup(true);
      wrapper.setNodeLockingScheme("OPTIMISTIC");
      wrapper.setIsolationLevel("READ_UNCOMMITTED");
      wrapper.setLockAcquisitionTimeout(200);
      wrapper.setReplicationVersion("1.0.1");
      wrapper.setReplQueueInterval(15);
      wrapper.setReplQueueMaxElements(50);
      wrapper.setSyncReplTimeout(300);
      wrapper.setSyncCommitPhase(true);
      wrapper.setSyncRollbackPhase(true);
      wrapper.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
      wrapper.setExposeManagementStatistics(false);
      wrapper.setUseRegionBasedMarshalling(true);
      wrapper.setUseReplQueue(true);

      Configuration c = wrapper.getConfiguration();

      assertEquals("CacheMode", "REPL_SYNC", wrapper.getCacheMode());
      assertEquals("CacheMode", CacheMode.REPL_SYNC, c.getCacheMode());
      assertEquals("ClusterName", "LocalTest", wrapper.getClusterName());
      assertEquals("ClusterName", "LocalTest", c.getClusterName());
      assertEquals("FetchInMemoryState", false, wrapper.getFetchInMemoryState());
      assertEquals("FetchInMemoryState", false, c.isFetchInMemoryState());
      assertEquals("InitialStateRetrievalTimeout", 100, wrapper.getInitialStateRetrievalTimeout());
      assertEquals("InitialStateRetrievalTimeout", 100, c.getStateRetrievalTimeout());
      assertEquals("InactiveOnStartup", true, wrapper.isInactiveOnStartup());
      assertEquals("InactiveOnStartup", true, c.isInactiveOnStartup());
      assertEquals("NodeLockingScheme", "OPTIMISTIC", wrapper.getNodeLockingScheme());
      assertEquals("NodeLockingScheme", NodeLockingScheme.OPTIMISTIC, c.getNodeLockingScheme());
      assertEquals("IsolationLevel", "READ_UNCOMMITTED", wrapper.getIsolationLevel());
      assertEquals("IsolationLevel", IsolationLevel.READ_UNCOMMITTED, c.getIsolationLevel());
      assertEquals("LockAcquisitionTimeout", 200, wrapper.getLockAcquisitionTimeout());
      assertEquals("LockAcquisitionTimeout", 200, c.getLockAcquisitionTimeout());
      assertEquals("ReplicationVersion", "1.0.1", wrapper.getReplicationVersion());
      assertEquals("ReplicationVersion", Version.getVersionShort("1.0.1"), c.getReplicationVersion());
      assertEquals("ReplQueueInterval", 15, wrapper.getReplQueueInterval());
      assertEquals("ReplQueueInterval", 15, c.getReplQueueInterval());
      assertEquals("ReplQueueMaxElements", 50, wrapper.getReplQueueMaxElements());
      assertEquals("ReplQueueMaxElements", 50, c.getReplQueueMaxElements());
      assertEquals("SyncReplTimeout", 300, wrapper.getSyncReplTimeout());
      assertEquals("SyncReplTimeout", 300, c.getSyncReplTimeout());
      assertEquals("SyncCommitPhase", true, wrapper.getSyncCommitPhase());
      assertEquals("SyncCommitPhase", true, c.isSyncCommitPhase());
      assertEquals("SyncRollbackPhase", true, wrapper.getSyncRollbackPhase());
      assertEquals("SyncRollbackPhase", true, c.isSyncRollbackPhase());
      assertEquals("TransactionManagerLookupClass", BatchModeTransactionManagerLookup.class.getName(), wrapper.getTransactionManagerLookupClass());
      assertEquals("TransactionManagerLookupClass", BatchModeTransactionManagerLookup.class.getName(), c.getTransactionManagerLookupClass());
      assertEquals("ExposeManagementStatistics", false, wrapper.getExposeManagementStatistics());
      assertEquals("ExposeManagementStatistics", false, c.getExposeManagementStatistics());
      assertEquals("UseRegionBasedMarshalling", true, wrapper.getUseRegionBasedMarshalling());
      assertEquals("UseRegionBasedMarshalling", true, c.isUseRegionBasedMarshalling());
      assertEquals("UseReplQueue", true, wrapper.getUseReplQueue());
      assertEquals("UseReplQueue", true, c.isUseReplQueue());

      assertEquals("ClusterConfig", getClusterConfig().toString(), wrapper.getClusterConfig().toString());

      assertEquals("BuddyReplicationConfig", getBuddyReplicationConfig().toString(), wrapper.getBuddyReplicationConfig().toString());
      BuddyReplicationConfig brc = c.getBuddyReplicationConfig();
      assertEquals("BR enabled", true, brc.isEnabled());
      assertEquals("BR auto grav", false, brc.isAutoDataGravitation());
      assertEquals("BR remove find", false, brc.isDataGravitationRemoveOnFind());
      assertEquals("BR search backup", false, brc.isDataGravitationSearchBackupTrees());
      assertEquals("BR comm timeout", 600000, brc.getBuddyCommunicationTimeout());
      assertEquals("BR poolname", "testpool", brc.getBuddyPoolName());
      BuddyLocatorConfig blc = brc.getBuddyLocatorConfig();
      assertEquals("BR locator", "org.jboss.cache.buddyreplication.TestBuddyLocator", blc.getBuddyLocatorClass());
      Properties props = blc.getBuddyLocatorProperties();
      assertEquals("BR props", "2", props.get("numBuddies"));

      assertEquals("CacheLoaderConfig", getCacheLoaderConfig().toString(), wrapper.getCacheLoaderConfig().toString());
      CacheLoaderConfig clc = c.getCacheLoaderConfig();
      assertEquals("CL passivation", false, clc.isPassivation());
      assertEquals("CL passivation", true, clc.isShared());
      assertEquals("CL preload", "/foo", clc.getPreload());
      List<IndividualCacheLoaderConfig> iclcs = clc.getIndividualCacheLoaderConfigs();
      IndividualCacheLoaderConfig iclc = iclcs.get(0);
      assertEquals("CL0 class", FileCacheLoader.class.getName(), iclc.getClassName());
      assertEquals("CL0 async", false, iclc.isAsync());
      assertEquals("CL0 fetch", true, iclc.isFetchPersistentState());
      assertEquals("CL0 ignore", true, iclc.isIgnoreModifications());
      assertEquals("CL0 purge", true, iclc.isPurgeOnStartup());
      assertEquals("CL0 singleton", true, iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
      assertEquals("CL0 singleton class", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
      iclc = iclcs.get(1);
      assertEquals("CL1 class", JdbmCacheLoader.class.getName(), iclc.getClassName());
      assertEquals("CL1 async", true, iclc.isAsync());
      assertEquals("CL1 fetch", false, iclc.isFetchPersistentState());
      assertEquals("CL1 ignore", false, iclc.isIgnoreModifications());
      assertEquals("CL1 purge", false, iclc.isPurgeOnStartup());
      assertEquals("CL1 singleton", false, iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
      assertEquals("CL1 singleton class", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());

      assertEquals("EvictionPolicyConfig", getEvictionPolicyConfig().toString(), wrapper.getEvictionPolicyConfig().toString());
      EvictionConfig ec = c.getEvictionConfig();
      assertEquals("EC queue size", 1000, ec.getDefaultEvictionRegionConfig().getEventQueueSize());
      assertEquals("EC wakeup", 5000, ec.getWakeupInterval());
      assertEquals("EC default pol", LRUAlgorithm.class.getName(), ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig().getEvictionAlgorithmClassName());
      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();
View Full Code Here

   public void testInjectCacheJmxWrapper() throws Exception
   {
      createTcpCacheServer();
      Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(conf);
      CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
      wrapper.start();
      cache_server.setCacheJmxWrapper(wrapper);
      startTcpCacheServer();
      createCacheAndLoader();
      cacheCheck();
      usabilityCheck();
View Full Code Here

         super.registerCache(cache, configName);
        
         if (registerCachesInJmx && mbeanServer != null)
         {
            String oName = getObjectName(getCoreCacheJmxAttributes(), configName);
            CacheJmxWrapper wrapper = new CacheJmxWrapper(cache);
            try
            {
               mbeanServer.registerMBean(wrapper, new ObjectName(oName));
            }
            catch (JMException e)
View Full Code Here

   public void testCacheJmxIntegration() throws Exception
   {
      log.debug("+++ testCacheJmxIntegration()");
     
      mbeanServer = MBeanServerFactory.createMBeanServer("cacheJmxTest");
      CacheJmxWrapper wrapper = null;
      try
      {
         // Register a cache
         wrapper = new CacheJmxWrapper();
         // JBAS-4097 -- don't use a TransactionManagerLookup that will
         // bind DummyTransactionManager into JNDI, as that will screw
         // up other tests
         wrapper.setTransactionManagerLookupClass(MockTransactionManagerLookup.class.getName());
         wrapper.setCacheMode("REPL_SYNC");
         mbeanServer.registerMBean(wrapper, new ObjectName(CACHE_OBJECT_NAME));
         wrapper.create();
         wrapper.start();
        
         // Build up an SSO infrastructure based on LOCAL_ADDRESS        
         JBossCacheSSOClusterManager localSSOManager = new JBossCacheSSOClusterManager();
        
         MockSSOValve localValve = new MockSSOValve(mbeanServer);
         localValve.setCacheConfig(CACHE_OBJECT_NAME);
         localValve.setClusterManager(localSSOManager);
         localSSOManager.setSSOLocalManager(localValve);
         localSSOManager.start();
        
         // Create an SSO that will have two sessions from local valve
         localSSOManager.register("1", "FORM", "Brian", "password");
        
         Manager localSessMgr1 = getSessionManager("A");
         Session sess1 = new MockSession(localSessMgr1, "1");
         localSSOManager.addSession("1", getFullyQualifiedSessionId(sess1));
        
         Manager localSessMgr2 = getSessionManager("B");
         Session sess2 = new MockSession(localSessMgr2, "2");
         localSSOManager.addSession("1", getFullyQualifiedSessionId(sess2));
        
         // Confirm that data is cached properly
         assertEquals("SSO 1 has correct number of sessions", 2, localSSOManager.getSessionCount("1"));  
      }
      finally
      {
         try
         {
            if (wrapper != null)
            {
               wrapper.stop();
               wrapper.destroy();
            }
         }
         catch (Exception ignored)
         {           
         }
View Full Code Here

   }

   @SuppressWarnings({"deprecation", "unchecked"})
   private void doTest(boolean legacy) throws Exception
   {
      CacheJmxWrapperMBean<String, String> wrapper = new CacheJmxWrapper();
      registerWrapper(wrapper);

      wrapper = (CacheJmxWrapperMBean<String, String>) MBeanServerInvocationHandler.newProxyInstance(mBeanServer, mBeanName, CacheJmxWrapperMBean.class, false);

      wrapper.setBuddyReplicationConfig(getBuddyReplicationConfig(legacy));
      wrapper.setCacheLoaderConfig(getCacheLoaderConfig(legacy));
      wrapper.setCacheMode("REPL_SYNC");
      wrapper.setClusterName("LocalTest");
      wrapper.setClusterConfig(getClusterConfig());
      wrapper.setEvictionPolicyConfig(getEvictionPolicyConfig(legacy));
      wrapper.setFetchInMemoryState(false);
      wrapper.setInitialStateRetrievalTimeout(100);
      wrapper.setInactiveOnStartup(true);
      wrapper.setNodeLockingScheme("OPTIMISTIC");
      wrapper.setIsolationLevel("READ_UNCOMMITTED");
      wrapper.setLockAcquisitionTimeout(200);
      wrapper.setReplicationVersion("1.0.1");
      wrapper.setReplQueueInterval(15);
      wrapper.setReplQueueMaxElements(50);
      wrapper.setSyncReplTimeout(300);
      wrapper.setSyncCommitPhase(true);
      wrapper.setSyncRollbackPhase(true);
      wrapper.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
      wrapper.setExposeManagementStatistics(false);
      wrapper.setUseRegionBasedMarshalling(true);
      wrapper.setUseReplQueue(true);

      Configuration c = wrapper.getConfiguration();

      assertEquals("CacheMode", "REPL_SYNC", wrapper.getCacheMode());
      assertEquals("CacheMode", CacheMode.REPL_SYNC, c.getCacheMode());
      assertEquals("ClusterName", "LocalTest", wrapper.getClusterName());
      assertEquals("ClusterName", "LocalTest", c.getClusterName());
      assertEquals("FetchInMemoryState", false, wrapper.getFetchInMemoryState());
      assertEquals("FetchInMemoryState", false, c.isFetchInMemoryState());
      assertEquals("InitialStateRetrievalTimeout", 100, wrapper.getInitialStateRetrievalTimeout());
      assertEquals("InitialStateRetrievalTimeout", 100, c.getStateRetrievalTimeout());
      assertEquals("InactiveOnStartup", true, wrapper.isInactiveOnStartup());
      assertEquals("InactiveOnStartup", true, c.isInactiveOnStartup());
      assertEquals("NodeLockingScheme", "OPTIMISTIC", wrapper.getNodeLockingScheme());
      assertEquals("NodeLockingScheme", NodeLockingScheme.OPTIMISTIC, c.getNodeLockingScheme());
      assertEquals("IsolationLevel", "READ_UNCOMMITTED", wrapper.getIsolationLevel());
      assertEquals("IsolationLevel", IsolationLevel.READ_UNCOMMITTED, c.getIsolationLevel());
      assertEquals("LockAcquisitionTimeout", 200, wrapper.getLockAcquisitionTimeout());
      assertEquals("LockAcquisitionTimeout", 200, c.getLockAcquisitionTimeout());
      assertEquals("ReplicationVersion", "1.0.1", wrapper.getReplicationVersion());
      assertEquals("ReplicationVersion", Version.getVersionShort("1.0.1"), c.getReplicationVersion());
      assertEquals("ReplQueueInterval", 15, wrapper.getReplQueueInterval());
      assertEquals("ReplQueueInterval", 15, c.getReplQueueInterval());
      assertEquals("ReplQueueMaxElements", 50, wrapper.getReplQueueMaxElements());
      assertEquals("ReplQueueMaxElements", 50, c.getReplQueueMaxElements());
      assertEquals("SyncReplTimeout", 300, wrapper.getSyncReplTimeout());
      assertEquals("SyncReplTimeout", 300, c.getSyncReplTimeout());
      assertEquals("SyncCommitPhase", true, wrapper.getSyncCommitPhase());
      assertEquals("SyncCommitPhase", true, c.isSyncCommitPhase());
      assertEquals("SyncRollbackPhase", true, wrapper.getSyncRollbackPhase());
      assertEquals("SyncRollbackPhase", true, c.isSyncRollbackPhase());
      assertEquals("TransactionManagerLookupClass", BatchModeTransactionManagerLookup.class.getName(), wrapper.getTransactionManagerLookupClass());
      assertEquals("TransactionManagerLookupClass", BatchModeTransactionManagerLookup.class.getName(), c.getTransactionManagerLookupClass());
      assertEquals("ExposeManagementStatistics", false, wrapper.getExposeManagementStatistics());
      assertEquals("ExposeManagementStatistics", false, c.getExposeManagementStatistics());
      assertEquals("UseRegionBasedMarshalling", true, wrapper.getUseRegionBasedMarshalling());
      assertEquals("UseRegionBasedMarshalling", true, c.isUseRegionBasedMarshalling());
      assertEquals("UseReplQueue", true, wrapper.getUseReplQueue());
      assertEquals("UseReplQueue", true, c.isUseReplQueue());

      assertEquals("ClusterConfig", getClusterConfig().toString(), wrapper.getClusterConfig().toString());

      assertEquals("BuddyReplicationConfig", getBuddyReplicationConfig(legacy).toString(), wrapper.getBuddyReplicationConfig().toString());
      BuddyReplicationConfig brc = c.getBuddyReplicationConfig();
      assertEquals("BR enabled", true, brc.isEnabled());
      assertEquals("BR auto grav", false, brc.isAutoDataGravitation());
      assertEquals("BR remove find", false, brc.isDataGravitationRemoveOnFind());
      assertEquals("BR search backup", false, brc.isDataGravitationSearchBackupTrees());
      assertEquals("BR comm timeout", 600000, brc.getBuddyCommunicationTimeout());
      assertEquals("BR poolname", "testpool", brc.getBuddyPoolName());
      BuddyLocatorConfig blc = brc.getBuddyLocatorConfig();
      assertEquals("BR locator", "org.jboss.cache.buddyreplication.TestBuddyLocator", blc.getBuddyLocatorClass());
      Properties props = blc.getBuddyLocatorProperties();
      assertEquals("BR props", "2", props.get("numBuddies"));

      assertEquals("CacheLoaderConfig", getCacheLoaderConfig(legacy).toString(), wrapper.getCacheLoaderConfig().toString());
      CacheLoaderConfig clc = c.getCacheLoaderConfig();
      assertEquals("CL passivation", false, clc.isPassivation());
      assertEquals("CL passivation", true, clc.isShared());
      assertEquals("CL preload", "/foo", clc.getPreload());
      List<IndividualCacheLoaderConfig> iclcs = clc.getIndividualCacheLoaderConfigs();
      IndividualCacheLoaderConfig iclc = iclcs.get(0);
      assertEquals("CL0 class", FileCacheLoader.class.getName(), iclc.getClassName());
      assertEquals("CL0 async", false, iclc.isAsync());
      assertEquals("CL0 fetch", true, iclc.isFetchPersistentState());
      assertEquals("CL0 ignore", true, iclc.isIgnoreModifications());
      assertEquals("CL0 purge", true, iclc.isPurgeOnStartup());
      assertEquals("CL0 singleton", true, iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
      assertEquals("CL0 singleton class", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());
      iclc = iclcs.get(1);
      assertEquals("CL1 class", JdbmCacheLoader.class.getName(), iclc.getClassName());
      assertEquals("CL1 async", true, iclc.isAsync());
      assertEquals("CL1 fetch", false, iclc.isFetchPersistentState());
      assertEquals("CL1 ignore", false, iclc.isIgnoreModifications());
      assertEquals("CL1 purge", false, iclc.isPurgeOnStartup());
      assertEquals("CL1 singleton", false, iclc.getSingletonStoreConfig().isSingletonStoreEnabled());
      assertEquals("CL1 singleton class", SingletonStoreCacheLoader.class.getName(), iclc.getSingletonStoreConfig().getSingletonStoreClass());

      assertEquals("EvictionPolicyConfig", getEvictionPolicyConfig(legacy).toString(), wrapper.getEvictionPolicyConfig().toString());
      EvictionConfig ec = c.getEvictionConfig();
      assertEquals("EC queue size", 1000, ec.getDefaultEvictionRegionConfig().getEventQueueSize());
      assertEquals("EC wakeup", 5000, ec.getWakeupInterval());
      assertEquals("EC default pol", LRUAlgorithm.class.getName(), ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig().getEvictionAlgorithmClassName());
      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();
View Full Code Here

   public void testInjectCacheJmxWrapper() throws Exception
   {
      createTcpCacheServer();
      Configuration conf = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      CacheSPI cacheSPI = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
      CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
      wrapper.start();
      cache_server.setCacheJmxWrapper(wrapper);
      startTcpCacheServer();
      createCacheAndLoader();
      cacheCheck();
      usabilityCheck();
View Full Code Here

         super.registerCache(cache, configName);
        
         if (registerCachesInJmx && mbeanServer != null)
         {
            String oName = getObjectName(getCoreCacheJmxAttributes(), configName);
            CacheJmxWrapper wrapper = new CacheJmxWrapper(cache);
            try
            {
               mbeanServer.registerMBean(wrapper, new ObjectName(oName));
            }
            catch (JMException e)
View Full Code Here

      }
   }

   private CacheJmxWrapper buildPlainCacheWrapper(PojoCache pojoCache)
   {
      CacheJmxWrapper plainCache = new CacheJmxWrapper();
      plainCache.setRegisterInterceptors(getRegisterInterceptors());
      plainCache.setCache(pojoCache.getCache());
      // It shouldn't send out lifecycle state change notifications for itself;
      // we do it
      plainCache.setDisableStateChangeNotifications(true);

      if (server != null)
      {
         plainCache.setNotificationServiceName(cacheObjectName);
      }

      // Add any NotificationListeners we registered before creating
      // the CacheJmxWrapper
      synchronized (pendingListeners)
      {
         for (NotificationListenerArgs args : pendingListeners)
         {
            plainCache.addNotificationListener(args.listener, args.filter, args.handback);
         }
      }
      return plainCache;
   }
View Full Code Here

   public void testInjectCacheJmxWrapper() throws Exception
   {
      createTcpCacheServer();
      Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      CacheSPI cacheSPI = (CacheSPI) new DefaultCacheFactory().createCache(conf);
      CacheJmxWrapper wrapper = new CacheJmxWrapper<Object, Object>(cacheSPI);
      wrapper.start();
      cache_server.setCacheJmxWrapper(wrapper);
      startTcpCacheServer();
      createCacheAndLoader();
      cacheCheck();
      usabilityCheck();
View Full Code Here

TOP

Related Classes of org.jboss.cache.jmx.CacheJmxWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.