[jbosscache-commits] JBoss Cache SVN: r7820 - core/branches/flat/src/main/java/org/horizon/loader/bdbje.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Mar 2 06:16:48 EST 2009


Author: adriancole
Date: 2009-03-02 06:16:48 -0500 (Mon, 02 Mar 2009)
New Revision: 7820

Modified:
   core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java
Log:
refactored to use AbstractCacheStore

Modified: core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java	2009-03-02 10:47:32 UTC (rev 7819)
+++ core/branches/flat/src/main/java/org/horizon/loader/bdbje/BdbjeCacheStore.java	2009-03-02 11:16:48 UTC (rev 7820)
@@ -8,12 +8,11 @@
 import com.sleepycat.je.*;
 import com.sleepycat.util.ExceptionUnwrapper;
 import org.horizon.Cache;
+import org.horizon.loader.AbstractCacheStore;
 import org.horizon.loader.CacheLoaderConfig;
 import org.horizon.loader.CacheLoaderException;
-import org.horizon.loader.CacheStore;
 import org.horizon.loader.StoredEntry;
 import org.horizon.loader.modifications.Modification;
-import org.horizon.loader.modifications.Remove;
 import org.horizon.logging.Log;
 import org.horizon.logging.LogFactory;
 import org.horizon.marshall.Marshaller;
@@ -23,7 +22,6 @@
 import java.io.File;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -57,7 +55,7 @@
  * @version $Id: $
  * @since 1.0
  */
-public class BdbjeCacheStore implements CacheStore {
+public class BdbjeCacheStore extends AbstractCacheStore {
 
    private static final Log log = LogFactory.getLog(BdbjeCacheStore.class);
 
@@ -261,12 +259,12 @@
    }
 
    /**
-    * {@inheritDoc} delegates to {@link BdbjeCacheStore#onePhaseCommit(java.util.List)}, if <code>isOnePhase</code>.
+    * {@inheritDoc} delegates to {@link BdbjeCacheStore#applyModifications(java.util.List)}, if <code>isOnePhase</code>.
     * Otherwise, delegates to {@link BdbjeCacheStore#prepare(java.util.List, javax.transaction.Transaction) prepare}.
     */
    public void prepare(List<? extends Modification> mods, javax.transaction.Transaction tx, boolean isOnePhase) throws CacheLoaderException {
       if (isOnePhase) {
-         onePhaseCommit(mods);
+         applyModifications(mods);
       } else {
          prepare(mods, tx);
       }
@@ -279,7 +277,8 @@
     * @param mods actions to perform atomically
     * @throws CacheLoaderException on problems during the transaction
     */
-   protected void onePhaseCommit(List<? extends Modification> mods) throws CacheLoaderException {
+   @Override
+   protected void applyModifications(List<? extends Modification> mods) throws CacheLoaderException {
       checkOpen();
       checkNonNull(mods, "modifications");
       log.debug("performing one phase transaction");
@@ -405,14 +404,6 @@
    }
 
    /**
-    * {@inheritDoc} This implementation delegates to {@link BdbjeCacheStore#load(Object)}, to ensure that a response is
-    * returned only if the entry is not expired.
-    */
-   public boolean containsKey(Object key) throws CacheLoaderException {
-      return load(key) != null;
-   }
-
-   /**
     * {@inheritDoc} This implementation delegates to {@link StoredMap#remove(Object)}
     */
    public boolean remove(Object key) throws CacheLoaderException {
@@ -432,20 +423,6 @@
    }
 
    /**
-    * {@inheritDoc} This implementation removes the <code>keys</code> atomically by creating a list of {@link Remove}
-    * modifications and passing that to {@link BdbjeCacheStore#onePhaseCommit(java.util.List)}.
-    */
-   public void removeAll(Set<Object> keys) throws CacheLoaderException {
-      checkOpen();
-      checkNonNull(keys, "keys");
-      List<Remove> toRemove = new ArrayList<Remove>();
-      for (Object key : keys) {
-         toRemove.add(new Remove(key));
-      }
-      onePhaseCommit(toRemove);
-   }
-
-   /**
     * {@inheritDoc} This implementation delegates to {@link StoredMap#get(Object)}.  If the object is expired, it will
     * not be returned.
     */




More information about the jbosscache-commits mailing list