Package org.jboss.cache

Examples of org.jboss.cache.Region


      {
         log_.debug("UseMarshalling is true. We will inactivate the fqn: " +
                    pathFqn + " and un-register its classloader");
           
         try {
            Region region = plainCache_.getRegion(pathFqn, false);
            if (region != null)
            {
               region.deactivate();
               region.unregisterContextClassLoader();
            }
         }
         catch (Exception e)
         {
            log_.error("Exception during inactivation of webapp region " + pathFqn +
View Full Code Here


    */
   private static <K, V> void addEvictionRegion(Fqn<String> fqn, Cache<K, V> cache, Configuration cfg)
   {
      EvictionConfig ec = cfg.getEvictionConfig();
      // Create the region and set the config
      Region region = cache.getRegion(fqn, true);
      if (ec != null && ec.getDefaultEvictionRegionConfig() != null)
      {
         EvictionRegionConfig erc = new EvictionRegionConfig(fqn);
         erc.setDefaults(ec.getDefaultEvictionRegionConfig());
         region.setEvictionRegionConfig(erc);
      }
   }
View Full Code Here

            if (root.hasChild(pathFqn) == false)
            {
               plainCache_.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
               root.addChild(pathFqn);
            }
            Region region = plainCache_.getRegion(pathFqn, true);
            region.registerContextClassLoader(webAppClassLoader_);
            region.activate();
         }
         catch (Exception ex)
         {
            throw new RuntimeException("Can't register class loader", ex);
         }
View Full Code Here

      {
         log_.debug("UseMarshalling is true. We will inactivate the fqn: " +
                    pathFqn + " and un-register its classloader");
           
         try {
            Region region = plainCache_.getRegion(pathFqn, false);
            if (region != null)
            {
               region.deactivate();
               region.unregisterContextClassLoader();
            }
         }
         catch (Exception e)
         {
            log_.error("Exception during inactivation of webapp region " + pathFqn +
View Full Code Here

   {
      if (cache.getConfiguration().isInactiveOnStartup())
      {
         if (cache.getConfiguration().isUseRegionBasedMarshalling())
         {
            Region region =cache.getRegion(Fqn.fromElements(SSO), true);
            try
            {
               region.activate();
            }
            catch (RegionNotEmptyException e)
            {
               log.debug(SSO + " region already active", e);
            }
View Full Code Here

      this.regionManager = regionManager;
   }

   protected void regionAwareMarshall(Fqn fqn, Object toMarshall) throws Exception
   {
      Region r = regionManager == null ? null : regionManager.getValidMarshallingRegion(fqn);
      ClassLoader originalClassLoader = null;
      boolean needToResetLoader = false;
      Thread current = null;

      if (r != null)
      {
         // set the region's class loader as the thread's context classloader
         needToResetLoader = true;
         current = Thread.currentThread();
         originalClassLoader = current.getContextClassLoader();
         current.setContextClassLoader(r.getClassLoader());
      }

      try
      {
         doMarshall(fqn, toMarshall);
View Full Code Here

      }
   }

   protected Object regionAwareUnmarshall(Fqn fqn, Object toUnmarshall) throws Exception
   {
      Region r = regionManager == null ? null : regionManager.getValidMarshallingRegion(fqn);
      ClassLoader originalClassLoader = null;
      boolean needToResetLoader = false;
      Thread current = null;

      if (r != null)
      {
         if (trace)
            log.trace("Using region " + r.getFqn() + ", which has registered class loader " + r.getClassLoader() + " as a context class loader.");
         // set the region's class loader as the thread's context classloader
         needToResetLoader = true;
         current = Thread.currentThread();
         originalClassLoader = current.getContextClassLoader();
         current.setContextClassLoader(r.getClassLoader());
      }

      try
      {
         return doUnmarshall(fqn, toUnmarshall);
View Full Code Here

         else
         {
            target = factory.createNode(fqn, parent, attrs);
            parent.addChild(fqn.getLastElement(), target);
            // JBCACHE-913
            Region region = cache.getRegion(fqn, false);
            if (region != null && region.getEvictionRegionConfig() != null)
            {
               region.registerEvictionEvent(fqn, EvictionEvent.Type.ADD_NODE_EVENT, attrs == null ? 0 : attrs.size());
            }
         }

         // Recursively call, which will walk down the tree
         // and return the next NodeData that's a child of our parent
View Full Code Here

   protected Fqn<String> addEvictionRegion(ExoCacheConfig config, Cache<Serializable, Object> cache,
      EvictionAlgorithmConfig eac)
   {
      Fqn<String> fqn = Fqn.fromElements(config.getName());
      // Create the region
      Region region = cache.getRegion(fqn, true);
      // Set the eviction region config
      region.setEvictionRegionConfig(new EvictionRegionConfig(fqn, eac));
      return fqn;
   }
View Full Code Here

      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

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.