Package org.jboss.cache

Examples of org.jboss.cache.Region


   @Override
   public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
   {
      Object retVal = invokeNextInterceptor(ctx, command);
      Region r;
      if (command.getFqn() != null && (r = getRegion(command.getFqn())) != null)
      {
         registerEvictionEventToRegionManager(command.getFqn(), REMOVE_NODE_EVENT, 0, r);
      }
      return retVal;
View Full Code Here


            // Reset things by inactivating the region
            // and enabling the stressors
            for (int i = 0; i < count; i++)
            {
               Region r = cacheA.getRegion(Fqn.fromString("/" + names[i]), true);
               r.registerContextClassLoader(getClass().getClassLoader());
               r.deactivate();
               System.out.println("Run " + x + "-- /" + names[i] + " deactivated on A");
               stressors[i].startPuts();
            }

            // Release the semaphore to allow the threads to start work
View Full Code Here

   /**
    * Again, see org.jboss.cache for more extensive tests on Regions.  This just tests the getRegion API on cache.
    */
   public void testRegion()
   {
      Region rootRegion = cache.getRegion(Fqn.ROOT, true);
      assertNotNull(rootRegion);// guaranteed never to return null if createIfAbsent is true.
      assertSame(rootRegion, cache.getRegion(Fqn.ROOT, true));

      Region otherRegion = cache.getRegion(Fqn.fromString("/other/region"), true);
      assertNotNull(otherRegion);
      assertSame(otherRegion, cache.getRegion(Fqn.fromString("/other/region"), true));
   }
View Full Code Here

   /**
    * Again, see org.jboss.cache for more extensive tests on Regions.  This just tests the getRegion API on cache.
    */
   public void testParentRegion1()
   {
      Region rootRegion = cache.getRegion(Fqn.ROOT, true);
      assertNotNull(rootRegion);// guaranteed never to return null if createIfAbsent is true.
      assertSame(rootRegion, cache.getRegion(Fqn.ROOT, false));

      Region otherRegion = cache.getRegion(Fqn.fromString("/other/region"), false);
      // should return the same parent region as root.

      assertSame(otherRegion, rootRegion);
   }
View Full Code Here

   /**
    * Again, see org.jboss.cache for more extensive tests on Regions.  This just tests the getRegion API on cache.
    */
   public void testParentRegion2()
   {
      Region rootRegion = cache.getRegion(Fqn.ROOT, true);
      Region parentRegion = cache.getRegion(Fqn.fromString("/parent"), true);
      assertNotSame("parentRegion should be a new region in its own right", rootRegion, parentRegion);

      Region childRegion = cache.getRegion(Fqn.fromString("/parent/region"), false);
      assertSame("Expecting the same region as parentRegion", childRegion, parentRegion);
   }
View Full Code Here

   /**
    * Again, see org.jboss.cache for more extensive tests on Regions.  This just tests the getRegion API on cache.
    */
   public void testNullRegion()
   {
      Region myRegion = cache.getRegion(Fqn.fromString("/myregion"), true);
      assertNotNull(myRegion);// guaranteed never to return null if createIfAbsent is true.
      assertSame(myRegion, cache.getRegion(Fqn.fromString("/myregion"), false));

      Region otherRegion = cache.getRegion(Fqn.fromString("/other/region"), false);
      // should return null since no eviction is in use.
      assert otherRegion == null;
   }
View Full Code Here

      FooClassLoader loader = new FooClassLoader(originalClassLoaderTL.get());

      if (useRegionBased)
      {
         Region r = cache.getRegion(Fqn.ROOT, true);
         r.registerContextClassLoader(loader);
         r.activate();
      }

      Class clazz = loader.loadFoo();
      Object obj = clazz.newInstance();
View Full Code Here

      cache.start();

      URLClassLoader ucl1 = createOrphanClassLoader();
      Thread.currentThread().setContextClassLoader(ucl1);

      Region region = cache.getRegion(fqn("/"), true);
      region.registerContextClassLoader(Thread.currentThread().getContextClassLoader());
      region.activate();

      Class clazz1 = ucl1.loadClass(INSTANCE_CLASS_NAME);
      cache.put(fqn("/a"), "key", clazz1.newInstance());

      region.deactivate();
      region.unregisterContextClassLoader();

      Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());

      region.registerContextClassLoader(Thread.currentThread().getContextClassLoader());

      try
      {
         Global object = (Global) cache.get(fqn("/a"), "key");
         assertNull(object);
      }
      catch (ClassCastException cce)
      {
//         cce.printStackTrace();
         fail("Should not have produced a ClassCastException");
      }

      region.deactivate();
      region.unregisterContextClassLoader();
   }
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.expectAny();
      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

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.