Package org.jboss.cache

Examples of org.jboss.cache.CacheManager


         try
         {
            // Determine if our cache is a PojoCache or a plain Cache
            if (cacheObjectName == null)
            {
               CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
               cache = cm.getCache(cacheName, true);              
            }
            else if (server != null)
            {           
               // Look in JMX
               MBeanInfo info = server.getMBeanInfo(cacheObjectName);
View Full Code Here


       
        String name = PropertiesHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
        if (name == null)
            throw new CacheException("Configuration property " + CACHE_FACTORY_RESOURCE_PROP + " not set");
       
        CacheManager cf = locateCacheFactory( name, NamingHelper.getJndiProperties( properties ) );
        setCacheFactory( cf );       
       
        super.start(settings, properties);
    }
View Full Code Here

       
        String name = PropertiesHelper.getString(CACHE_FACTORY_RESOURCE_PROP, properties, null);
        if (name == null)
            throw new CacheException("Configuration property " + CACHE_FACTORY_RESOURCE_PROP + " not set");
       
        CacheManager cf = locateCacheFactory( name, NamingHelper.getJndiProperties( properties ) );
        setCacheFactory( cf );       
       
        super.start(settings, properties);
    }
View Full Code Here

   {
      super.tearDown();
     
      this.channelFactory = null;
     
      CacheManager jbcFactory = this.cacheManagerRef.get();
      this.cacheManagerRef.set(null);
      ((CacheManagerImpl) jbcFactory).stop();
   }
View Full Code Here

       cacheManagers.put(name, manager);
    }
   
    public static void clearCacheManagers() {
       for (java.util.Iterator it = cacheManagers.values().iterator(); it.hasNext();) {
          CacheManager cm = (CacheManager) it.next();
          try
          {
             if (cm instanceof CacheManagerImpl)
                 ((CacheManagerImpl) cm).stop();
          }
View Full Code Here

    @Override
    public void start(Settings settings, Properties properties) throws CacheException {
      
        cacheManagerName = properties.getProperty(DualNodeTestUtil.NODE_ID_PROP);
       
        CacheManager existing = getTestCacheManager(cacheManagerName);
        locallyAdded = (existing == null);
        if (!locallyAdded) {
           setCacheFactory(existing);
        }
       
View Full Code Here

  
   protected void queryTest(boolean useNamedRegion) throws Exception
   {
      // Bind a listener to the "local" cache
      // Our region factory makes its CacheManager available to us
      CacheManager localManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.LOCAL);
      this.localCache = localManager.getCache(getEntityCacheConfigName(), true);
      this.localListener = new CacheAccessListener();
      localCache.addCacheListener(localListener);
     
      TransactionManager localTM = localCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
      // Bind a listener to the "remote" cache
      CacheManager remoteManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.REMOTE);
      this.remoteCache = remoteManager.getCache(getEntityCacheConfigName(), true);
      this.remoteListener = new CacheAccessListener();
      remoteCache.addCacheListener(remoteListener);     
     
      TransactionManager remoteTM = remoteCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
View Full Code Here

   // ------------------------------------------------------------------  Tests
  
   public void testRefreshAfterExternalChange() throws Exception
   {
      // First session factory uses a cache
      CacheManager localManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.LOCAL);
      this.localCache = localManager.getCache(getEntityCacheConfigName(), true);     
      TransactionManager localTM = localCache.getConfiguration().getRuntimeConfig().getTransactionManager();
      SessionFactory localFactory = getEnvironment().getSessionFactory();
     
      // Second session factory doesn't; just needs a transaction manager
      TransactionManager remoteTM = DualNodeJtaTransactionManagerImpl.getInstance(DualNodeTestUtil.REMOTE);
View Full Code Here

   {
      System.out.println("*** testAll()");
     
      // Bind a listener to the "local" cache
      // Our region factory makes its CacheManager available to us
      CacheManager localManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.LOCAL);
      Cache localCache = localManager.getCache(getEntityCacheConfigName(), true);
      MyListener localListener = new MyListener();
      localCache.addCacheListener(localListener);
     
      TransactionManager localTM = localCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
      // Bind a listener to the "remote" cache
      CacheManager remoteManager = TestCacheInstanceManager.getTestCacheManager(DualNodeTestUtil.REMOTE);
      Cache remoteCache = remoteManager.getCache(getEntityCacheConfigName(), true);
      MyListener remoteListener = new MyListener();
      remoteCache.addCacheListener(remoteListener);     
     
      TransactionManager remoteTM = remoteCache.getConfiguration().getRuntimeConfig().getTransactionManager();
     
View Full Code Here

  
   protected void releaseCacheToManager(String cacheConfigName)
   {     
      try
      {
         CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
         cm.releaseCache(cacheConfigName);
      }
      catch (Exception e)
      {
         log_.error("Problem releasing cache to CacheManager -- config is " + cacheConfigName, e);
      }
View Full Code Here

TOP

Related Classes of org.jboss.cache.CacheManager

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.