Package org.jboss.cache.eviction

Examples of org.jboss.cache.eviction.EvictionPolicy


      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();

      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(RegionManagerImpl.DEFAULT_REGION);
      EvictionPolicy policy = LRUPolicy.class.newInstance();
      erc.setEvictionPolicyConfig(policy.getEvictionConfigurationClass().newInstance());

      ercs.add(erc);

      ec.setEvictionRegionConfigs(ercs);
View Full Code Here


   public void setDefaultEvictionPolicyClass(String defaultEvictionPolicyClass)
   {
      assertIsTransformable(defaultEvictionPolicyClass);
      try
      {
         EvictionPolicy policy = (EvictionPolicy) Util.getInstance(defaultEvictionPolicyClass);
         EvictionAlgorithm ea = policy.getEvictionAlgorithm();
         defaultEvictionRegionConfig.setEvictionAlgorithmConfig(Util.getInstance(ea.getConfigurationClass()));
         this.defaultEvictionPolicyClass = defaultEvictionPolicyClass;
      }
      catch (Exception e)
      {
View Full Code Here

   public static final void assertIsTransformable(String evictionPolicyClass) throws UnsupportedEvictionImplException
   {
      boolean throwException = true;
      if (evictionPolicyClass.indexOf("org.jboss.cache.eviction") > -1)
      {
         EvictionPolicy ep = null;
         try
         {
            ep = (EvictionPolicy) Util.getInstance(evictionPolicyClass);
            if (ep instanceof ModernizablePolicy) throwException = false;
         }
View Full Code Here

      EvictionAlgorithm algorithm;

      try
      {
         EvictionPolicy ep = (EvictionPolicy) Util.getInstance(evictionClass);
         Class<? extends EvictionAlgorithm> algoClass = ((ModernizablePolicy) ep).modernizePolicy();
         if (log.isTraceEnabled()) log.trace("Using algo class " + algoClass);
         algorithm = Util.getInstance(algoClass);
      }
      catch (RuntimeException e)
View Full Code Here

      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();

      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(RegionManagerImpl.DEFAULT_REGION);
      EvictionPolicy policy = LRUPolicy.class.newInstance();
      erc.setEvictionPolicyConfig(policy.getEvictionConfigurationClass().newInstance());

      ercs.add(erc);

      ec.setEvictionRegionConfigs(ercs);
View Full Code Here

         throw new IllegalArgumentException("null className");
      }
      try
      {
         if (log.isTraceEnabled()) log.trace("Instantiating " + className);
         EvictionPolicy ep = (EvictionPolicy) Util.loadClass(className).newInstance();
         ep.setCache(regionManager.getCache());
         return ep;
      }
      catch (Exception e)
      {
         log.fatal("Unable to instantiate eviction policy class " + className, e);
View Full Code Here

      EvictionAlgorithm algorithm;

      try
      {
         EvictionPolicy ep = (EvictionPolicy) Util.getInstance(evictionClass);
         Class<? extends EvictionAlgorithm> algoClass = ((ModernizablePolicy) ep).modernizePolicy();
         if (log.isTraceEnabled()) log.trace("Using algo class " + algoClass);
         algorithm = Util.getInstance(algoClass);
      }
      catch (RuntimeException e)
View Full Code Here

            throw new MissingPolicyException(
                  "There is no Eviction Policy Class specified on the region or for the entire cache!");
         }
      }

      EvictionPolicy policy = null;
      try
      {
         policy = (EvictionPolicy) Util.loadClass(evictionClass).newInstance();
      }
      catch (RuntimeException e)
      {
         throw e;
      }
      catch (Exception e)
      {
         throw new RuntimeException("Eviction class is not properly loaded in classloader", e);
      }

      EvictionPolicyConfig epc = null;
      try
      {
         epc = policy.getEvictionConfigurationClass().newInstance();
      }
      catch (RuntimeException e)
      {
         throw e;
      }
      catch (Exception e)
      {
         throw new RuntimeException("Failed to instantiate eviction configuration of class " +
               policy.getEvictionConfigurationClass(), e);
      }

      parseEvictionPolicyConfig(element, epc);

      erc.setEvictionPolicyConfig(epc);
View Full Code Here

      if (defaultEvictionPolicyClass != null)
      {
         try
         {
            Class<?> cpolicy = Class.forName(defaultEvictionPolicyClass);
            EvictionPolicy policy = (EvictionPolicy) cpolicy.newInstance();
            EvictionRegionConfig erc = new EvictionRegionConfig();
            EvictionPolicyConfig epc = policy.getEvictionConfigurationClass().newInstance();
            erc.setEvictionPolicyConfig(epc);
            erc.setRegionFqn(RegionManager.DEFAULT_REGION);
            return erc;
         }
         catch (Exception e)
View Full Code Here

     
      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();
     
      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(RegionManager.DEFAULT_REGION);
      EvictionPolicy policy = LRUPolicy.class.newInstance();
      erc.setEvictionPolicyConfig(policy.getEvictionConfigurationClass().newInstance());
     
      ercs.add(erc);
     
      ec.setEvictionRegionConfigs(ercs);
     
View Full Code Here

TOP

Related Classes of org.jboss.cache.eviction.EvictionPolicy

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.