Examples of PojoCache


Examples of org.jboss.cache.pojo.PojoCache

   public PojoCache getPojoCache(String configName, boolean create) throws Exception
   {
      // Check if there's an alias involved
      configName = resolveAlias(configName);
     
      PojoCache cache = null;
      synchronized (pojoCaches)
      {
         if (getCacheNames().contains(configName))
            throw new IllegalStateException("Cannot create PojoCache: plain cache already created for config " + configName);
        
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

         if (create && pojoCaches.containsKey(configName))
         {
            log.debug("Plain cache requested for config " + configName +
                      " but a PojoCache is already registered; returning " +
                      " the PojoCache's underlying plain cache");
            PojoCache pc = getPojoCache(configName, false);
            if (pc != null)
               return wrapCache(pc.getCache());
         }
        
         return wrapCache(super.getCache(configName, create));
      }
   }
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

      {
         if (pojoCaches.containsKey(configName))
         {
            if (decrementPojoCacheCheckout(configName) == 0)
            {
               PojoCache cache = pojoCaches.remove(configName);
               destroyPojoCache(configName, cache);
            }           
         }
         else
         {
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

      for (Map.Entry<String, Boolean> entry : startupCaches.entrySet())
      {
         Cache cache = null;
         if (entry.getValue().booleanValue())
         {
            PojoCache pc = getPojoCache(entry.getKey(), true);
            cache = pc.getCache();
         }
         else
         {
            cache = getCache(entry.getKey(), true);
         }
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

   public static JBossCacheManager createManager(String warName, int maxInactiveInterval,
                                                 boolean local, String passivationDir,
                                                 boolean totalReplication, boolean marshalling,
                                                 String jvmRoute, Set<PojoCache> allCaches)
   {
      PojoCache cache = createCache(local, passivationDir, totalReplication, marshalling, allCaches);
      return createManager(warName, maxInactiveInterval, cache, jvmRoute);
   }
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

  
   public static PojoCache createCache(boolean local, String passivationDir,
         boolean totalReplication, boolean marshalling, Set<PojoCache> allCaches)
   {
      Configuration cfg = getConfiguration(local, passivationDir, totalReplication, marshalling);
      PojoCache cache = PojoCacheFactory.createCache(cfg, true);
     
      if (allCaches != null)
         allCaches.add(cache);
      return cache;
   }
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

   }
  
   public static Configuration getConfiguration(boolean local, String passivationDir,
         boolean totalReplication, boolean marshalling)
   {
      PojoCache temp = PojoCacheFactory.createCache(CONFIG_LOCATION, false);
      Configuration config = temp.getCache().getConfiguration();
      if (local)
         config.setCacheMode(CacheMode.LOCAL);
      if (passivationDir == null)
      {
         config.setCacheLoaderConfig(null);
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

   {
      log.info("Enter testUseJK");
     
      ++testCount;
      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, null, false, false, null, caches);
      PojoCache cache = SessionTestUtil.getDistributedCacheManagerFactoryPojoCache();
      JBossWebMetaData webMetaData = createWebMetaData(null, null, null, null, null);
      jbcm.init("test.war", webMetaData);     
      jbcm.start();

      assertFalse("With no config, not using JK", jbcm.getUseJK());
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

   {
      log.info("Enter testSnapshot");
     
      ++testCount;
      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, null, false, false, null, caches);
      PojoCache cache = SessionTestUtil.getDistributedCacheManagerFactoryPojoCache();
     
      JBossWebMetaData webMetaData = createWebMetaData(null, null, null, null, null);
      jbcm.init("test.war", webMetaData);     
      jbcm.start();
View Full Code Here

Examples of org.jboss.cache.pojo.PojoCache

         throws Exception
   {
      ++testCount;
      String passDir = getPassivationDir(testCount, 1);
      JBossCacheManager jbcm = SessionTestUtil.createManager("test" + testCount, 300, true, passDir, false, false, null, caches);
      PojoCache cache = SessionTestUtil.getDistributedCacheManagerFactoryPojoCache();
     
      JBossWebMetaData webMetaData = SessionTestUtil.createWebMetaData(2, true, 3, 1);
      jbcm.init("test.war", webMetaData);
     
      jbcm.start();
     
      assertTrue("Passivation is enabled", jbcm.isPassivationEnabled());
      assertEquals("Correct max active count", 2, jbcm.getMaxActiveAllowed());
      assertEquals("Correct max idle time", 3, jbcm.getPassivationMaxIdleTime());
      assertEquals("Correct min idle time", 1, jbcm.getPassivationMinIdleTime());
     
      // Set up a session
      createAndUseSession(jbcm, "1", true, true);
     
      assertEquals("Session count correct", 1, jbcm.getActiveSessionCount());
      assertEquals("Local session count correct", 1, jbcm.getLocalActiveSessionCount());
     
      // And a 2nd
      createAndUseSession(jbcm, "2", true, true);    
     
      assertEquals("Session count correct", 2, jbcm.getActiveSessionCount());
      assertEquals("Local session count correct", 2, jbcm.getLocalActiveSessionCount());    
      assertEquals("Created session count correct", 2, jbcm.getCreatedSessionCount());
      assertEquals("Expired session count correct", 0, jbcm.getExpiredSessionCount());

      //    Sleep past minIdleTime
      SessionTestUtil.sleepThread(1100);
     
      assertEquals("Passivated session count correct", 0, jbcm.getPassivatedSessionCount());
     
      createAndUseSession(jbcm, "3", true, true);     
     
      assertEquals("Session count correct", 2, jbcm.getActiveSessionCount());
      assertEquals("Local session count correct", 2, jbcm.getLocalActiveSessionCount());
      assertEquals("Created session count correct", 3, jbcm.getCreatedSessionCount());
      assertEquals("Expired session count correct", 0, jbcm.getExpiredSessionCount());
      assertEquals("Passivated session count correct", 1, jbcm.getPassivatedSessionCount());
     
      jbcm.stop();
     
      if (restartCache)
      {
         cache.stop();
         cache.destroy();
         caches.remove(cache);
        
         passDir = getPassivationDir(testCount, 1);
         jbcm = SessionTestUtil.createManager("test" + testCount, 5, true, passDir, false, false, null, caches);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.