Package org.jboss.cache

Examples of org.jboss.cache.Region


      // c2's cache marshaller's thread local would be polluted now.

      // restart c1 so that it forces a state transfer from c2
      c1.destroy();
      c1.create();
      Region r = c1.getRegion(fqn.getParent(), true);
      r.registerContextClassLoader(getClass().getClassLoader());
      r.deactivate();
      c1.start();

      TestingUtil.blockUntilViewsReceived(60000, c1, c2);

      // assert that the state has been transferred to C1
View Full Code Here


      Fqn fqn2 = Fqn.fromString("/a/b");
      Fqn fqn3 = Fqn.fromString("/aop");

      List<Region> expected = new ArrayList<Region>(4);

      Region region = r.getRegion(DEFAULT_REGION, true);
      region.registerContextClassLoader(getClass().getClassLoader());
      assertEquals(DEFAULT_REGION, region.getFqn());
      expected.add(region);

      region = r.getRegion(fqn1, true);
      region.registerContextClassLoader(getClass().getClassLoader());
      assertEquals(fqn1, region.getFqn());
      expected.add(region);

      region = r.getRegion(fqn2, true);
      region.registerContextClassLoader(getClass().getClassLoader());
      assertEquals(fqn2, region.getFqn());
      expected.add(region);

      region = r.getRegion(fqn3, true);
      region.registerContextClassLoader(getClass().getClassLoader());
      assertEquals(fqn3, region.getFqn());
      expected.add(region);

      // should sort these now ...
      Collections.sort(expected);
      Iterator<Region> expectedRegions = expected.iterator();
View Full Code Here

      Fqn fqn2 = Fqn.fromString("/a/b/");

      r.getRegion(fqn1, true);
      r.getRegion(fqn2, true);

      Region region = null;
      try
      {
         region = r.getRegion("/a", false);
      }
      catch (Exception e)
View Full Code Here

      String fqn3 = "/a";

      r.getRegion(fqn1, true);
      r.getRegion(fqn3, true);

      Region region = r.getRegion(fqn2, false);
      assertEquals("Should be the same region as in " + fqn3, r.getRegion(fqn3, false), region);
   }
View Full Code Here

   {
      String fqn1 = "/a";
      String fqn2 = "/a/b";
      String fqn3 = "/a/b/c";

      Region r1 = r.getRegion(fqn1, true);
      Region r2 = r.getRegion(fqn2, true);
      Region r3 = r.getRegion(fqn3, true);

      assertEquals("Expecting 3 regions", 3, r.getAllRegions(Region.Type.ANY).size());

      // test that removal doesn't affect parent traversal.
      assertEquals(r3, r.getRegion(fqn3, false));
View Full Code Here

   {
      String f1 = "/a", f2 = "/b", f3 = "/c", f4 = "/d";

      r.setDefaultInactive(true);

      @SuppressWarnings("unused")
      Region r1 = r.getRegion(f1, true), r2 = r.getRegion(f2, true), r3 = r.getRegion(f3, true), r4 = r.getRegion(f4, true);

      assertEquals("4 regions should exist", 4, r.getAllRegions(Region.Type.ANY).size());

      assertEquals("None of the regions should marshalling or active", 0, r.getAllRegions(Region.Type.MARSHALLING).size());
View Full Code Here

      assertEquals("v", caches.get(0).get(f, "k"));
      assertEquals("v", caches.get(1).get(f, "k"));

      // create the region on cache 0, make sure it is marked as a MARSHALLING region by attaching a class loader to it.
      Region region0 = caches.get(0).getRegionManager().getRegion(f, true);
      region0.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
      assertTrue("Should be active by default", region0.isActive());
      // make sure this newly created region is "recognised" as a marshalling region.
      assertTrue(caches.get(0).getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region0));

      // now create a region on cache 1, as above.
      Region region1 = caches.get(1).getRegionManager().getRegion(f, true);
      region1.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
      assertTrue("Should be active by default", region1.isActive());
      // make sure this newly created region is "recognised" as a marshalling region.
      assertTrue(caches.get(1).getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region1));

      // now deactivate the region on cache 1.
      region1.deactivate();
      assertFalse("Should be have deactivated", region1.isActive());

      caches.get(0).put(f, "k", "v2");
      assertEquals("v2", caches.get(0).get(f, "k"));
      assertNull(caches.get(1).get(f, "k"));
View Full Code Here

      c.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
   }

   protected void createAndActivateRegion(CacheSPI<Object, Object> c, Fqn f)
   {
      Region r = c.getRegion(f, true);
      r.registerContextClassLoader(getClass().getClassLoader());
      r.activate();
   }
View Full Code Here

   {
      switch (marshallingMode)
      {
         case CUSTOM_CLASSLOADER_WITH_REGIONS:
            cache1.getConfiguration().setUseRegionBasedMarshalling(true);
            Region region1 = cache1.getRegion(fqn("/a"), true);
            region1.registerContextClassLoader(customClassLoader);
            cache2.getConfiguration().setUseRegionBasedMarshalling(true);
            Region region2 = cache2.getRegion(fqn("/a"), true);
            region2.registerContextClassLoader(customClassLoader);
            // and carry on to the same setting as DEFAULT_WITHOUT_MARSHALLED_VALUES
         case DEFAULT_WITHOUT_MARSHALLED_VALUES:
            cache1.getConfiguration().setUseLazyDeserialization(false);
            cache2.getConfiguration().setUseLazyDeserialization(false);
            break;
View Full Code Here

      ClassLoader c1 = getClassLoader();
      ClassLoader c2 = getClassLoader();

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


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

      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(c1);
      cache1.put(aop, "person", srtl.ben_);
      if (useMarshalledValues) resetContextClassLoader();
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.