[jboss-cvs] JBossAS SVN: r80086 - projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 26 18:28:20 EDT 2008


Author: manik.surtani at jboss.com
Date: 2008-10-26 18:28:20 -0400 (Sun, 26 Oct 2008)
New Revision: 80086

Added:
   projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUAlgorithmConfiguration.java
Removed:
   projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUPolicy.java
Modified:
   projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
Log:
Upgraded eviction configuration to match new JBC 3.x API

Added: projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUAlgorithmConfiguration.java
===================================================================
--- projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUAlgorithmConfiguration.java	                        (rev 0)
+++ projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUAlgorithmConfiguration.java	2008-10-26 22:28:20 UTC (rev 80086)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.cache.tree;
+
+import org.jboss.cache.eviction.LRUAlgorithmConfig;
+
+/**
+ *
+ * @author Manik Surtani (<a href="mailto:manik AT jboss DOT org">manik AT jboss DOT org</a>)
+ */
+public class AbortableLRUAlgorithmConfiguration extends LRUAlgorithmConfig
+{
+   @Override
+   public String getEvictionAlgorithmClassName()
+   {
+      return AbortableLRUAlgorithm.class.getName();
+   }
+}

Deleted: projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUPolicy.java
===================================================================
--- projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUPolicy.java	2008-10-26 18:24:16 UTC (rev 80085)
+++ projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/AbortableLRUPolicy.java	2008-10-26 22:28:20 UTC (rev 80086)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.ejb3.cache.tree;
-
-import org.jboss.cache.eviction.LRUPolicy;
-
-/**
- * LRUPolicy subclass with an algorithm that doesn't error log
- * ContextInUseException.
- * 
- * @author <a href="brian.stansberry at jboss.com">Brian Stansberry</a>
- * @version $Revision: 1.1 $
- */
-public class AbortableLRUPolicy extends LRUPolicy
-{
-   public AbortableLRUPolicy()
-   {
-      super();
-      algorithm = new AbortableLRUAlgorithm();
-   }
-   
-}

Modified: projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
===================================================================
--- projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2008-10-26 18:24:16 UTC (rev 80085)
+++ projects/ejb3/dev/Branch_JBoss_Cache_3/core/src/main/java/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2008-10-26 22:28:20 UTC (rev 80086)
@@ -21,15 +21,6 @@
  */
 package org.jboss.ejb3.cache.tree;
 
-import java.lang.ref.WeakReference;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.ejb.EJBException;
-import javax.ejb.NoSuchEJBException;
-
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheException;
 import org.jboss.cache.CacheManager;
@@ -39,6 +30,7 @@
 import org.jboss.cache.Region;
 import org.jboss.cache.RegionNotEmptyException;
 import org.jboss.cache.config.EvictionPolicyConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
 import org.jboss.cache.eviction.LRUConfiguration;
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.NodeActivated;
@@ -48,7 +40,6 @@
 import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.annotation.CacheConfig;
 import org.jboss.ejb3.cache.ClusteredStatefulCache;
-import org.jboss.ejb3.pool.Pool;
 import org.jboss.ejb3.stateful.NestedStatefulBeanContext;
 import org.jboss.ejb3.stateful.ProxiedStatefulBeanContext;
 import org.jboss.ejb3.stateful.StatefulBeanContext;
@@ -57,6 +48,14 @@
 import org.jboss.logging.Logger;
 import org.jboss.util.id.GUID;
 
+import javax.ejb.EJBException;
+import javax.ejb.NoSuchEJBException;
+import java.lang.ref.WeakReference;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * Clustered SFSB cache that uses JBoss Cache to cache and replicate
  * bean contexts.
@@ -301,14 +300,13 @@
          removalTask = new RemovalTimeoutTask("SFSB Removal Thread - " + this.ejbContainer.getObjectName().getCanonicalName());
    }
 
-   protected EvictionPolicyConfig getEvictionPolicyConfig()
+   protected EvictionRegionConfig getEvictionRegionConfig(Fqn fqn)
    {
-      LRUConfiguration epc = new LRUConfiguration();
-      // Override the standard policy class
-      epc.setEvictionPolicyClass(AbortableLRUPolicy.class.getName());
-      epc.setTimeToLiveSeconds((int) cacheConfig.idleTimeoutSeconds());
-      epc.setMaxNodes(cacheConfig.maxSize());
-      return epc;
+      AbortableLRUAlgorithmConfiguration algoCfg = new AbortableLRUAlgorithmConfiguration();
+      EvictionRegionConfig erc = new EvictionRegionConfig(fqn, algoCfg);
+      algoCfg.setTimeToLiveSeconds((int) cacheConfig.idleTimeoutSeconds());
+      algoCfg.setMaxNodes(cacheConfig.maxSize());
+      return erc;
    }
 
    public void start()
@@ -338,8 +336,8 @@
       
       // Try to create an eviction region per ejb
       region = cache.getRegion(cacheNode, true);
-      EvictionPolicyConfig epc = getEvictionPolicyConfig();
-      region.setEvictionPolicy(epc);
+      EvictionRegionConfig erc = getEvictionRegionConfig(cacheNode);
+      region.setEvictionRegionConfig(erc);
 
       if (cache.getCacheStatus() != CacheStatus.STARTED)
       {




More information about the jboss-cvs-commits mailing list