Package org.jboss.cache

Examples of org.jboss.cache.Region


      regionManager.setUsingEvictions(true);
      regionManager.getRegion(DEFAULT_REGION, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_BC, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_B, true).setEvictionRegionConfig(config);

      Region region = regionManager.getRegion(A_BC, true);
      assertNotSame("Region ", DEFAULT_REGION, region.getFqn());
   }
View Full Code Here


      rm.getRegion(DEFAULT_REGION, true).setEvictionRegionConfig(config);
      rm.getRegion(A_B_C_D_E, true).setEvictionRegionConfig(config);
      rm.getRegion(A_B_C_D, true).setEvictionRegionConfig(config);
      rm.getRegion(A_B_C, true).setEvictionRegionConfig(config);

      Region region = rm.getRegion("/a/b/c/d/e/f", false);
      Region region2 = rm.getRegion("/e/f/g", false);

      assertEquals(A_B_C_D_E, region.getFqn());
      assertEquals(DEFAULT_REGION, region2.getFqn());

      List<Region> regions = rm.getAllRegions(Region.Type.ANY);
      for (int i = 0; i < regions.size(); i++)
      {
         switch (i)
View Full Code Here

      ClassLoader cla = getClassLoader();
      ClassLoader clb = getClassLoader();

      if (!useMarshalledValues)
      {
         Region r1 = cache1.getRegion(aop, false) == null ? cache1.getRegion(aop, true) : cache1.getRegion(aop, false);
         r1.registerContextClassLoader(cla);

         Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
         r2.registerContextClassLoader(clb);
      }

      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
      TransactionManager tm = beginTransaction();
      cache1.put(Fqn.fromString("/aop/1"), "person", srtl.ben_);
View Full Code Here

      CacheSPI<Object, Object> cache2 = srtl.cache2;

      ClassLoader cla = getClassLoader();
      if (!useMarshalledValues)
      {
         Region r1 = cache1.getRegion(aop, false) == null ? cache1.getRegion(aop, true) : cache1.getRegion(aop, false);
         r1.registerContextClassLoader(cla);
      }
      ClassLoader clb = getClassLoader();
      if (!useMarshalledValues)
      {
         Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
         r2.registerContextClassLoader(clb);
      }

      TransactionManager tm = beginTransaction();
      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
      cache1.put(aop, "person", srtl.ben_);
View Full Code Here

      SyncReplTestTL srtl = threadLocal.get();
      CacheSPI<Object, Object> cache1 = srtl.cache1;
      CacheSPI<Object, Object> cache2 = srtl.cache2;

      FooClassLoader cl1 = new FooClassLoader(Thread.currentThread().getContextClassLoader());
      Region r1 = cache1.getRegion(aop, false) == null ? cache1.getRegion(aop, true) : cache1.getRegion(aop, false);
      r1.registerContextClassLoader(cl1);
      FooClassLoader cl2 = new FooClassLoader(Thread.currentThread().getContextClassLoader());
      Region r2 = cache2.getRegion(aop, false) == null ? cache2.getRegion(aop, true) : cache2.getRegion(aop, false);
      r2.registerContextClassLoader(cl2);

      Class clazz = cl1.loadFoo();
      Object custom1 = clazz.newInstance();

      clazz = cl2.loadFoo();
View Full Code Here

      PutKeyValueCommand put = new PutKeyValueCommand(null, A_B, "name", "Joe");
      ReplicateCommand replicate = new ReplicateCommand(put);

      rman.setDefaultInactive(true);
      // register A as an inactive marshalling region
      Region region_A = rman.getRegion(A, true);
      region_A.registerContextClassLoader(this.getClass().getClassLoader());
      assertFalse("New regions created should be inactive by default", region_A.isActive());
      cache.stop();
      c.setUseRegionBasedMarshalling(true);
      c.setInactiveOnStartup(true);
      VersionAwareMarshaller testee = createVAMandRestartCache(rman);
View Full Code Here

      CacheSPI cache2 = createCache("cache2", true, true, true);
      Fqn A = Fqn.fromString("/a");
      TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);

      // create the regions on the two caches first
      Region c1 = cache1.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);
      Region c2 = cache2.getRegionManager().getRegion(A, Region.Type.MARSHALLING, true);

      assertFalse(c1.isActive());
      assertFalse(c2.isActive());

      c1.activate();
      cache1.put(A_B, "name", JOE);

//      TestingUtil.sleepThread(getSleepTimeout());

      System.out.println("Cache dump BEFORE activation");
      System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
      System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));

      c2.activate();

      System.out.println("Cache dump AFTER activation");
      System.out.println("cache1 " + CachePrinter.printCacheDetails(cache1));
      System.out.println("cache2 " + CachePrinter.printCacheDetails(cache2));
View Full Code Here

      TestingUtil.blockUntilViewsReceived(VIEW_BLOCK_TIMEOUT, cache1, cache2);
      Fqn backupFqn = fqnTransformer.getBackupFqn(cache1.getLocalAddress(), A_B);
      Fqn A = Fqn.fromString("/a");

      Region regionA = cache1.getRegion(A, true);
      regionA.registerContextClassLoader(getClass().getClassLoader());
      regionA.activate();

      // Activate the buddy backup subtree in the recipient so any
      // repl message doesn't get rejected due to that tree being inactive
      cache2.getRegionManager().activate(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
      cache2.getRegionManager().deactivate(A);
View Full Code Here

   public void testBuddyBackupInactivation() throws Exception
   {
      CacheSPI cache1 = createCache("cache1", true, true, true);
      Fqn A = Fqn.fromString("/a");
      Region regionA = cache1.getRegion(A, true);
      regionA.registerContextClassLoader(getClass().getClassLoader());
      regionA.activate();

      Fqn fqn = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, "test");
      fqn = Fqn.fromRelativeFqn(fqn, A_B);
      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      cache1.put(fqn, "name", JOE);

      assertEquals("Put should have been OK", JOE, cache1.get(fqn, "name"));

      regionA.deactivate();

      assertNull("Inactivation should have cleared region", cache1.get(fqn, "name"));
   }
View Full Code Here

      {
         cache = setupCache("configs/policyPerRegion-eviction.xml");
         regionManager = cache.getRegionManager();
         assertEquals(5000, cache.getConfiguration().getEvictionConfig().getWakeupInterval());

         Region region = regionManager.getRegion("/org/jboss/data", true);
         EvictionRegionConfig evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/data"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LFUAlgorithmConfig);
         assertEquals(5000, ((LFUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000, ((LFUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMinNodes());

         region = regionManager.getRegion("/org/jboss/test/data", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/test/data"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig);
         assertEquals(5, ((FIFOAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         region = regionManager.getRegion("/test", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/test"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof MRUAlgorithmConfig);
         assertEquals(10000, ((MRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         region = regionManager.getRegion("/maxAgeTest", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/maxAgeTest"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(8000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

         // test the default region. use a region name that isn't defined explicitly in conf file.
         region = regionManager.getRegion("/a/b/c", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.ROOT, region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(-1, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());
View Full Code Here

TOP

Related Classes of org.jboss.cache.Region

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.