Package org.jboss.cache

Examples of org.jboss.cache.Region


      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

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

      if (!useMarshalledValues)
      {
         Region existing = cache1.getRegion(aop, true);
         existing.registerContextClassLoader(cla);
         existing = cache2.getRegion(aop, true);
         existing.registerContextClassLoader(clb);
      }

      if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
      replListener2.expect(PutKeyValueCommand.class);
      cache1.put(aop, "person", ben);
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);
      }

      // Create an empty Person loaded by this classloader
      Object scopedBen1 = getPersonFromClassloader(cla);
      // Create another empty Person loaded by this classloader
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);
      replListener2.expect(PutKeyValueCommand.class);
      beginTransaction();
View Full Code Here

   }

   public void testCustomFqn() throws Exception
   {
      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

      // 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

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.