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

Manik Surtani manik at jboss.org
Thu May 24 14:13:59 EDT 2007


  User: msurtani
  Date: 07/05/24 14:13:59

  Modified:    src/org/jboss/cache/loader    AsyncCacheLoader.java
  Added:       src/org/jboss/cache/loader    AsyncCacheLoaderConfig.java
  Removed:     src/org/jboss/cache/loader    AsynchCacheLoaderConfig.java
  Log:
  fixed buggy stuff around BG comms
  
  Revision  Changes    Path
  1.29      +13 -13    JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AsyncCacheLoader.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -b -r1.28 -r1.29
  --- AsyncCacheLoader.java	23 May 2007 10:28:57 -0000	1.28
  +++ AsyncCacheLoader.java	24 May 2007 18:13:59 -0000	1.29
  @@ -89,7 +89,7 @@
       */
      public static final int DEFAULT_QUEUE_SIZE = 10000;
   
  -   private AsynchCacheLoaderConfig config;
  +   private AsyncCacheLoaderConfig config;
      private AsyncProcessor processor;
      private AtomicBoolean stopped = new AtomicBoolean(true);
      private BlockingQueue<Modification> queue = new ArrayBlockingQueue<Modification>(DEFAULT_QUEUE_SIZE);
  @@ -106,13 +106,13 @@
   
      public void setConfig(IndividualCacheLoaderConfig base)
      {
  -      if (base instanceof AsynchCacheLoaderConfig)
  +      if (base instanceof AsyncCacheLoaderConfig)
         {
  -         config = (AsynchCacheLoaderConfig) base;
  +         config = (AsyncCacheLoaderConfig) base;
         }
         else
         {
  -         config = new AsynchCacheLoaderConfig(base);
  +         config = new AsyncCacheLoaderConfig(base);
         }
   
         if (config.getQueueSize() > 0)
  
  
  
  1.1      date: 2007/05/24 18:13:59;  author: msurtani;  state: Exp;JBossCache/src/org/jboss/cache/loader/AsyncCacheLoaderConfig.java
  
  Index: AsyncCacheLoaderConfig.java
  ===================================================================
  package org.jboss.cache.loader;
  
  import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
  
  import java.util.Properties;
  
  public class AsyncCacheLoaderConfig extends IndividualCacheLoaderConfig
  {
     /**
      * The serialVersionUID
      */
     private static final long serialVersionUID = 5038037589485991681L;
  
     private int batchSize = 100;
     private boolean returnOld = true;
     private int queueSize = 0;
     private boolean useAsyncPut = true;
  
     /**
      * Default constructor.
      */
     public AsyncCacheLoaderConfig()
     {
        setClassName(AsyncCacheLoader.class.getName());
     }
  
     /**
      * For use by {@link AsyncCacheLoader}.
      *
      * @param base generic config object created by XML parsing.
      */
     AsyncCacheLoaderConfig(IndividualCacheLoaderConfig base)
     {
        setClassName(AsyncCacheLoader.class.getName());
        populateFromBaseConfig(base);
     }
  
     public int getBatchSize()
     {
        return batchSize;
     }
  
     public void setBatchSize(int batchSize)
     {
        testImmutability("batchSize");
        this.batchSize = batchSize;
     }
  
     public int getQueueSize()
     {
        return queueSize;
     }
  
     public void setQueueSize(int queueSize)
     {
        testImmutability("queueSize");
        this.queueSize = queueSize;
     }
  
     public boolean getReturnOld()
     {
        return returnOld;
     }
  
     public void setReturnOld(boolean returnOld)
     {
        testImmutability("returnOld");
        this.returnOld = returnOld;
     }
  
     public boolean getUseAsyncPut()
     {
        return useAsyncPut;
     }
  
     public void setUseAsyncPut(boolean useAsyncPut)
     {
        testImmutability("useAsyncPut");
        this.useAsyncPut = useAsyncPut;
     }
  
     public void setProperties(Properties props)
     {
        super.setProperties(props);
        String s;
  
        s = props.getProperty("cache.async.batchSize");
        if (s != null)
        {
           batchSize = Integer.parseInt(s);
        }
        if (batchSize <= 0)
        {
           throw new IllegalArgumentException("Invalid size: " + batchSize);
        }
  
        s = props.getProperty("cache.async.returnOld");
        if (s != null)
        {
           returnOld = Boolean.valueOf(s);
        }
  
        s = props.getProperty("cache.async.queueSize");
        if (s != null)
        {
           queueSize = Integer.parseInt(s);
        }
  
        s = props.getProperty("cache.async.put");
        if (s != null)
        {
           useAsyncPut = Boolean.valueOf(s);
        }
     }
  
     public boolean equals(Object obj)
     {
        if (obj instanceof AsyncCacheLoaderConfig && equalsExcludingProperties(obj))
        {
           AsyncCacheLoaderConfig other = (AsyncCacheLoaderConfig) obj;
           return (batchSize == other.batchSize)
                   && (queueSize == other.queueSize)
                   && (returnOld == other.returnOld)
                   && (useAsyncPut == other.useAsyncPut);
        }
        return false;
     }
  
     public int hashCode()
     {
        int result = hashCodeExcludingProperties();
        result = 31 * result + batchSize;
        result = 31 * result + queueSize;
        result = 31 * result + (returnOld ? 0 : 1);
        result = 31 * result + (useAsyncPut ? 0 : 1);
        return result;
     }
  
  
  }
  
  



More information about the jboss-cvs-commits mailing list