Package org.jboss.cache

Examples of org.jboss.cache.Cache


   private DistributedCacheManagerFactoryImpl delegate = new DistributedCacheManagerFactoryImpl();

   public void configure(boolean local, String passivationDir, boolean totalReplication, boolean marshalling,
         boolean purgeCacheLoader)
   {
      Cache pc = createCache(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
      delegate.setPlainCache(pc);
   }
View Full Code Here


      return delegate.getDistributedCacheManager(localManager);
  

   public void cleanup(boolean doRemove)
   {
      Cache cache = delegate.getPlainCache();
      if (cache == null)
         return;
     
      if (doRemove && CacheStatus.STARTED.equals(cache.getCacheStatus()))
      {
         // Try to clean up so we avoid loading sessions
         // from storage in later tests
         try
         {
            log.info("Removing /JSESSION from " + cache.getLocalAddress());
            cache.removeNode(Fqn.fromString("/JSESSION"));
         }
         catch (Exception e)
         {
            log.error("Cache " + cache + ": " + e.getMessage(), e);
         }
      }
     
      try
      {
         cache.stop();
         cache.destroy();
      }
      catch (Exception e)
      {
         log.error("Cache " + cache + ": " + e.getMessage(), e);
      }
View Full Code Here

      return config;
   }

   public Object getLocalAddress()
   {
      Cache pc = delegate.getPlainCache();
      return pc == null ? null : pc.getLocalAddress();
   }
View Full Code Here

      return pc == null ? null : pc.getLocalAddress();
   }

   public List<Object> getMembers()
   {
      Cache pc = delegate.getPlainCache();
      return pc == null ? null : new ArrayList<Object>(pc.getMembers());
   }
View Full Code Here

         if (cacheHandler == null)
         {
            throw new IllegalStateException("No clustered cache available");
         }
        
         @SuppressWarnings("unchecked")
         Cache c = null;
         synchronized (cacheHandler)
         {
            c = cacheHandler.getCache();
            if (c == null)
View Full Code Here

            throw new IllegalStateException("No clustered cache available");
         }
        
         try
         {
            Cache c = null;
            synchronized (cacheHandler)
            {
               c = cacheHandler.getCache();
               if (c == null)
               {
View Full Code Here

      Properties prop = getProperties();

      // ensure cleanup after each test
      prop.setProperty("cache.jdbc.table.drop", "true");

      Cache cache = new DefaultCacheFactory<Object, Object>().createCache(false);
      Configuration config = cache.getConfiguration();
      config.setUseRegionBasedMarshalling(useRegionBased);
      config.setInactiveOnStartup(useRegionBased);

      EvictionConfig ec = new EvictionConfig();
      ec.setDefaultEvictionPolicyClass(LRUPolicy.class.getName());
View Full Code Here

      usabilityCheck();
   }

   private void cacheCheck()
   {
      Cache c = cache_server.getCache();
      assertNotNull("Cache exists", c);
      Configuration config = c.getConfiguration();
      // check a couple properties
      assertEquals("Correct mode", Configuration.CacheMode.LOCAL, config.getCacheMode());
      assertEquals("Correct cluster name", "JBossCache-Cluster", config.getClusterName());
   }
View Full Code Here

{
   public void testPessLocking() throws Exception
   {
      Configuration c = new Configuration();
      c.setNodeLockingScheme(Configuration.NodeLockingScheme.PESSIMISTIC);
      Cache cache = new DefaultCacheFactory().createCache(c);

      assertInterceptorsHaveSameCache((CacheSPI) cache);

      cache.stop();
   }
View Full Code Here

   public void testOptLocking() throws Exception
   {
      Configuration c = new Configuration();
      c.setNodeLockingScheme(Configuration.NodeLockingScheme.OPTIMISTIC);
      Cache cache = new DefaultCacheFactory().createCache(c);

      assertInterceptorsHaveSameCache((CacheSPI) cache);

      cache.stop();
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Cache

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.