Package org.jboss.cache

Examples of org.jboss.cache.RegionManager


      ComponentRegistry cr = this.cr;
      cr.registerComponent(cm200, CacheMarshaller200.class);
      cr.rewire();
      cr.start();

      RegionManager rm = cr.getComponent(RegionManager.class);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      final Fqn region = Fqn.fromString("/hello");
      Region r = rm.getRegion(region, true);
      r.registerContextClassLoader(this.getClass().getClassLoader());
      cm200.objectToObjectStream(new ClusteredGetCommand(false, null), oos, region);
      oos.close();

      final byte[] stream = baos.toByteArray();
View Full Code Here


      {
         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
         cfg.getEvictionConfig().setWakeupInterval(0);
         c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
         ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
         RegionManager rm = cr.getComponent(RegionManager.class);
         EvictionTimerTask ett = rm.getEvictionTimerTask();
         assert ett.scheduledExecutor == null;
      }
      finally
      {
         TestingUtil.killCaches(c);
View Full Code Here

      {
         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
         cfg.getEvictionConfig().setWakeupInterval(10);
         c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
         ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
         RegionManager rm = cr.getComponent(RegionManager.class);
         EvictionTimerTask ett = rm.getEvictionTimerTask();
         assert ett.scheduledExecutor != null;
      }
      finally
      {
         TestingUtil.killCaches(c);
View Full Code Here

   private void addStringBasedRegion() throws Exception
   {
      LRUAlgorithmConfig lru = new LRUAlgorithmConfig(150, 0, 1000);
      EvictionRegionConfig regConfig = new EvictionRegionConfig(Fqn.fromString("/dummy"), lru);

      RegionManager regionManager = cache.getRegionManager();
      EvictionConfig topConfig = cache.getConfiguration().getEvictionConfig();
      topConfig.addEvictionRegionConfig(regConfig);
      regionManager.setEvictionConfig(topConfig);
      // Fqn is the region name
      regionManager.getRegion("/programmatic", true).setEvictionRegionConfig(regConfig);
   }
View Full Code Here

   private void addObjectBasedRegion() throws Exception
   {
      LRUAlgorithmConfig lru = new LRUAlgorithmConfig(150, 1000);
      EvictionRegionConfig regConfig = new EvictionRegionConfig(Fqn.fromElements(1), lru);

      RegionManager regionManager = cache.getRegionManager();
      EvictionConfig topConfig = cache.getConfiguration().getEvictionConfig();
      topConfig.addEvictionRegionConfig(regConfig);
      regionManager.setEvictionConfig(topConfig);
      regionManager.getRegion(Fqn.fromElements(1), true).setEvictionRegionConfig(regConfig);
   }
View Full Code Here

   EvictionRegionConfig config = new EvictionRegionConfig(null, new NullEvictionAlgorithmConfig());

   public void testCreateRegion()
   {
      RegionManager regionManager = new RegionManagerImpl();
      ((RegionManagerImpl) regionManager).injectDependencies(null, null, null, null, null, new RegionRegistry());
      regionManager.setUsingEvictions(true);
      regionManager.getRegion(DEFAULT_REGION, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_B_C, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_B, true).setEvictionRegionConfig(config);
      regionManager.getRegion(AOP, true).setEvictionRegionConfig(config);

      List<Region> regions = regionManager.getAllRegions(Region.Type.ANY);
      assertEquals("Region size ", 4, regions.size());
   }
View Full Code Here

   }

   public void testCreateRegion2()
   {

      RegionManager regionManager = new RegionManagerImpl();
      ((RegionManagerImpl) regionManager).injectDependencies(null, null, null, null, null, new RegionRegistry());
      regionManager.setUsingEvictions(true);
      regionManager.getRegion(A_B_C, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_B, true).setEvictionRegionConfig(config);
      regionManager.getRegion(DEFAULT_REGION, true).setEvictionRegionConfig(config);

      List<Region> regions = regionManager.getAllRegions(Region.Type.ANY);
      assertEquals("Region size ", 3, regions.size());
      assertEquals("Region 0", DEFAULT_REGION, regions.get(0).getFqn());
      assertEquals("Region 1 ", A_B, regions.get(1).getFqn());
      assertEquals("Region 2 ", A_B_C, regions.get(2).getFqn());
      Region region = regionManager.getRegion("/a/b/c/d", false);
      assertNotNull("Region ", region);
      assertEquals("Region ", A_B_C, region.getFqn());
      region = regionManager.getRegion(A_B, false);
      assertNotNull("Region ", region);
      assertEquals("Region ", A_B, region.getFqn());
      region = regionManager.getRegion("/a", false);
      // Should be default.
      assertNotNull("Region ", region);
      assertEquals("Region ", DEFAULT_REGION, region.getFqn());
   }
View Full Code Here

      assertEquals("Region ", DEFAULT_REGION, region.getFqn());
   }

   public void testNoDefaultRegion()
   {
      RegionManager regionManager = new RegionManagerImpl();
      ((RegionManagerImpl) regionManager).injectDependencies(null, null, null, null, null, new RegionRegistry());
      regionManager.setUsingEvictions(true);
      regionManager.getRegion(A_B_C, true).setEvictionRegionConfig(config);
      regionManager.getRegion(A_B, true).setEvictionRegionConfig(config);

      regionManager.getRegion(Fqn.fromString("/a"), Region.Type.EVICTION, false);
   }
View Full Code Here

      regionManager.getRegion(Fqn.fromString("/a"), Region.Type.EVICTION, false);
   }

   public void testGetRegion()
   {
      RegionManager regionManager = new RegionManagerImpl();
      ((RegionManagerImpl) regionManager).injectDependencies(null, null, null, null, null, new RegionRegistry());
      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

   public void testRegionOrdering() throws Exception
   {
      Fqn A_B_C_D_E = Fqn.fromString("/a/b/c/d/e/");
      Fqn A_B_C_D = Fqn.fromString("/a/b/c/d/");

      RegionManager rm = new RegionManagerImpl();
      ((RegionManagerImpl) rm).injectDependencies(null, null, null, null, null, new RegionRegistry());
      rm.setUsingEvictions(true);
      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)
         {
            case 0:
View Full Code Here

TOP

Related Classes of org.jboss.cache.RegionManager

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.