[jboss-cvs] JBossCache/src/org/jboss/cache/loader/bdbje ...

Manik Surtani msurtani at jboss.com
Sat Dec 30 14:48:50 EST 2006


  User: msurtani
  Date: 06/12/30 14:48:50

  Modified:    src/org/jboss/cache/loader/bdbje  BdbjeCacheLoader.java
  Log:
  Genericised, autoboxed
  
  Revision  Changes    Path
  1.25      +13 -15    JBossCache/src/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BdbjeCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -b -r1.24 -r1.25
  --- BdbjeCacheLoader.java	30 Dec 2006 17:50:03 -0000	1.24
  +++ BdbjeCacheLoader.java	30 Dec 2006 19:48:50 -0000	1.25
  @@ -30,7 +30,6 @@
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.HashSet;
  -import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  @@ -50,7 +49,7 @@
    *
    * @author Mark Hayes May 16, 2004
    * @author Bela Ban
  - * @version $Id: BdbjeCacheLoader.java,v 1.24 2006/12/30 17:50:03 msurtani Exp $
  + * @version $Id: BdbjeCacheLoader.java,v 1.25 2006/12/30 19:48:50 msurtani Exp $
    */
   public class BdbjeCacheLoader extends AbstractCacheLoader
   {
  @@ -68,7 +67,7 @@
      private Database catalogDb;
      private StoredClassCatalog catalog;
      private SerialBinding serialBinding;
  -   private Map txnMap;
  +   private Map<Object, Transaction> txnMap;
      private boolean transactional;
   
      /*
  @@ -204,7 +203,7 @@
         serialBinding = new SerialBinding(catalog, null);
   
         /* Start with a fresh transaction map. */
  -      txnMap = new ConcurrentHashMap();
  +      txnMap = new ConcurrentHashMap<Object, Transaction>();
      }
   
      /**
  @@ -465,7 +464,7 @@
   
         Object oldVal = null;
         /* To update-or-insert, try putNoOverwrite first, then a RMW cycle. */
  -      Map map = new HashMap();
  +      Map<Object, Object> map = new HashMap<Object, Object>();
         map.put(key, value);
         DatabaseEntry dataEntry = makeDataEntry(map);
         DatabaseEntry keyEntry = makeKeyEntry(name);
  @@ -613,16 +612,15 @@
      /**
       * Internal version of put(List) that allows passing a transaction.
       */
  -   private void doPut(Transaction txn, List modifications)
  +   private void doPut(Transaction txn, List<Modification> modifications)
              throws Exception
      {
   
         /* This could be optimized by grouping modifications by Fqn, and
          * performing a single database operation for each Fqn (record). */
   
  -      for (Iterator i = modifications.iterator(); i.hasNext();)
  +      for (Modification mod : modifications)
         {
  -         Modification mod = (Modification) i.next();
            Fqn name = mod.getFqn();
            Object oldVal;
            switch (mod.getType())
  @@ -883,7 +881,7 @@
       * transactional. Commits the transaction if successful, or aborts the
       * transaction and throws an exception if not successful.
       */
  -   private void commitModifications(List mods)
  +   private void commitModifications(List<Modification> mods)
              throws Exception
      {
   
  @@ -897,7 +895,7 @@
       * retries.  Returns the transaction if successful; aborts the transaction
       * and throws an exception if not successful.
       */
  -   private Transaction performTransaction(List modifications)
  +   private Transaction performTransaction(List<Modification> modifications)
              throws Exception
      {
   
  @@ -942,7 +940,7 @@
         checkOpen();
         checkNonNull(tx, "tx");
   
  -      Transaction txn = (Transaction) txnMap.remove(tx);
  +      Transaction txn = txnMap.remove(tx);
         if (txn != null)
         {
            txn.commit();
  @@ -963,7 +961,7 @@
         checkOpen();
         checkNonNull(tx, "tx");
   
  -      Transaction txn = (Transaction) txnMap.remove(tx);
  +      Transaction txn = txnMap.remove(tx);
         if (txn != null)
         {
            try
  @@ -1072,12 +1070,12 @@
      /**
       * Converts a database entry to a Map.
       */
  -   private Map makeDataObject(DatabaseEntry entry, boolean createIfNull)
  +   private Map<Object, Object> makeDataObject(DatabaseEntry entry, boolean createIfNull)
      {
  -      Map map = (Map) serialBinding.entryToObject(entry);
  +      Map<Object, Object> map = (Map<Object, Object>) serialBinding.entryToObject(entry);
         if (createIfNull && map == null)
         {
  -         map = new HashMap();
  +         map = new HashMap<Object, Object>();
         }
         return map;
      }
  
  
  



More information about the jboss-cvs-commits mailing list