Examples of InfinispanRegionFactory


Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

   protected void setUp() throws Exception {
       super.setUp();
      
       if (getEntityAccessStrategy() == null) {
           Configuration cfg = createConfiguration();
           InfinispanRegionFactory rf  = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
          
           // Sleep a bit to avoid concurrent FLUSH problem
           avoidConcurrentFlush();
          
           EntityRegion localEntityRegion = rf.buildEntityRegion(REGION_NAME, cfg.getProperties(), null);
           setEntityRegionAccessStrategy(localEntityRegion.buildAccessStrategy(getAccessType()));
       }
   }
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      return CacheAdapterImpl.newInstance(regionFactory.getCacheManager().getCache("timestamps"));
   }

   public void testClearTimestampsRegionInIsolated() throws Exception {
      Configuration cfg = createConfiguration();
      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      Configuration cfg2 = createConfiguration();
      InfinispanRegionFactory regionFactory2 = CacheTestUtil.startRegionFactory(cfg2, getCacheTestSupport());
      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      TimestampsRegionImpl region = (TimestampsRegionImpl) regionFactory.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
      TimestampsRegionImpl region2 = (TimestampsRegionImpl) regionFactory2.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), cfg2.getProperties());
//      QueryResultsRegion region2 = regionFactory2.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg2.getProperties());

//      ClassLoader cl = Thread.currentThread().getContextClassLoader();
//      Thread.currentThread().setContextClassLoader(cl.getParent());
//      log.info("TCCL is " + cl.getParent());
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      Settings settings = cfg.buildSettings();
      Properties properties = cfg.getProperties();

      String factoryType = cfg.getProperty(Environment.CACHE_REGION_FACTORY);
      Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(factoryType);
      InfinispanRegionFactory regionFactory = (InfinispanRegionFactory) factoryClass.newInstance();

      regionFactory.start(settings, properties);

      return regionFactory;
   }
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      return regionFactory;
   }

   public static InfinispanRegionFactory startRegionFactory(Configuration cfg, CacheTestSupport testSupport)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
      InfinispanRegionFactory factory = startRegionFactory(cfg);
      testSupport.registerFactory(factory);
      return factory;
   }
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      putDoesNotBlockGetTest();
   }

   private void putDoesNotBlockGetTest() throws Exception {
      Configuration cfg = createConfiguration();
      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());

      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg
               .getProperties());

      region.put(KEY, VALUE1);
      assertEquals(VALUE1, region.get(KEY));
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      getDoesNotBlockPutTest();
   }

   private void getDoesNotBlockPutTest() throws Exception {
      Configuration cfg = createConfiguration();
      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());

      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg
               .getProperties());

      region.put(KEY, VALUE1);
      assertEquals(VALUE1, region.get(KEY));
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      return regionFactory.getCacheManager().getCache("timestamps").getAdvancedCache();
   }

   public void testClearTimestampsRegionInIsolated() throws Exception {
      Configuration cfg = createConfiguration();
      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(
        new StandardServiceRegistryBuilder().applySettings( cfg.getProperties() ).build(),
        cfg,
        getCacheTestSupport()
    );
      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      Configuration cfg2 = createConfiguration();
      InfinispanRegionFactory regionFactory2 = CacheTestUtil.startRegionFactory(
        new StandardServiceRegistryBuilder().applySettings( cfg.getProperties() ).build(),
        cfg2,
        getCacheTestSupport()
    );
      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      TimestampsRegionImpl region = (TimestampsRegionImpl) regionFactory.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
      TimestampsRegionImpl region2 = (TimestampsRegionImpl) regionFactory2.buildTimestampsRegion(getStandardRegionName(REGION_PREFIX), cfg2.getProperties());
//      QueryResultsRegion region2 = regionFactory2.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg2.getProperties());

//      ClassLoader cl = Thread.currentThread().getContextClassLoader();
//      Thread.currentThread().setContextClassLoader(cl.getParent());
//      log.info("TCCL is " + cl.getParent());
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

         Properties properties = cfg.getProperties();

         String factoryType = cfg.getProperty(Environment.CACHE_REGION_FACTORY);
         Class clazz = Thread.currentThread()
               .getContextClassLoader().loadClass(factoryType);
         InfinispanRegionFactory regionFactory;
         if (clazz == InfinispanRegionFactory.class) {
            regionFactory = new SingleNodeTestCase.TestInfinispanRegionFactory();
         } else {
            regionFactory = (InfinispanRegionFactory) clazz.newInstance();
         }
         regionFactory.start(settings, properties);
         return regionFactory;
      } catch (Exception e) {
         throw new RuntimeException(e);
      }
   }
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      }
   }

   public static InfinispanRegionFactory startRegionFactory(ServiceRegistry reg,
         Configuration cfg, CacheTestSupport testSupport) {
      InfinispanRegionFactory factory = startRegionFactory(reg, cfg);
      testSupport.registerFactory(factory);
      return factory;
   }
View Full Code Here

Examples of org.hibernate.cache.infinispan.InfinispanRegionFactory

      p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
      p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "30000");
      p.setProperty("hibernate.cache.infinispan.collection.eviction.strategy", "LRU");
      p.setProperty("hibernate.cache.infinispan.collection.eviction.wake_up_interval", "3500");
      p.setProperty("hibernate.cache.infinispan.collection.eviction.max_entries", "35000");
      InfinispanRegionFactory factory = createRegionFactory(p);
      try {
         factory.getCacheManager();
         EntityRegionImpl region = (EntityRegionImpl) factory.buildEntityRegion("com.acme.Address", p, null);
         assertNull(factory.getTypeOverrides().get("com.acme.Address"));
         cache = region.getCache();
         Configuration cacheCfg = cache.getCacheConfiguration();
         assertEquals(EvictionStrategy.LIRS, cacheCfg.eviction().strategy());
         assertEquals(3000, cacheCfg.expiration().wakeUpInterval());
         assertEquals(30000, cacheCfg.eviction().maxEntries());
         // Max idle value comes from base XML configuration
         assertEquals(100000, cacheCfg.expiration().maxIdle());

         CollectionRegionImpl collectionRegion = (CollectionRegionImpl)
               factory.buildCollectionRegion("com.acme.Person.addresses", p, null);
         assertNull(factory.getTypeOverrides().get("com.acme.Person.addresses"));
         cache = collectionRegion.getCache();
         cacheCfg = cache.getCacheConfiguration();
         assertEquals(EvictionStrategy.LRU, cacheCfg.eviction().strategy());
         assertEquals(3500, cacheCfg.expiration().wakeUpInterval());
         assertEquals(35000, cacheCfg.eviction().maxEntries());
         assertEquals(100000, cacheCfg.expiration().maxIdle());
      } finally {
         factory.stop();
      }
   }
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.