You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-dev@jakarta.apache.org by as...@apache.org on 2005/01/13 10:12:44 UTC

cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk AbstractDiskCache.java

asmuts      2005/01/13 01:12:44

  Modified:    src/java/org/apache/jcs/engine PooledCacheEventQueue.java
               src/conf log4j.properties cache2.ccf cache.ccf
               src/java/org/apache/jcs/auxiliary/lateral
                        LateralCacheNoWait.java
               src/java/org/apache/jcs/engine/behavior
                        ICacheEventQueue.java
               src/java/org/apache/jcs/engine/control CompositeCache.java
               auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/disk/bdbje
                        BDBJECacheAttributes.java BDBJECache.java
               xdocs    BasicJCSConfiguration.xml
               src/java/org/apache/jcs/auxiliary/disk
                        AbstractDiskCache.java
  Added:       tempbuild jcs-1.2.1-dev.jar
  Log:
  Fixed a bug that caused remote push to fail.
  
  The event queues have an isAlive and an isWorking status.  Originally isAlive meant that it hadn't died.  No isAlive means are there any threads that are running.  isWorking used to mean that there were threads working; now it means that the queue is in working order.  This terminology isn't clear and lead to a bug.  I will come up with new names.
  
  The remote server used to check to see if a queue was alive before trying to send an update to a local.  When we made the queues shutdown from inactivity, they started setting the isAlive to false.  The remote server would then think they were bad and not try to add events.  I now made the remote server check to see if the queue is working.
  
  updated to bug fix version 1.2.1
  
  Revision  Changes    Path
  1.2       +33 -30    jakarta-turbine-jcs/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java
  
  Index: PooledCacheEventQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/PooledCacheEventQueue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PooledCacheEventQueue.java	7 Jan 2005 22:30:41 -0000	1.1
  +++ PooledCacheEventQueue.java	13 Jan 2005 09:12:40 -0000	1.2
  @@ -37,25 +37,25 @@
   /**
    * An event queue is used to propagate ordered cache events to one and only one
    * target listener.
  - * 
  + *
    * This is a modified version of the experimental version. It uses a
    * PooledExecutor and a BoundedBuffer to queue up events and execute them as
    * threads become available.
  - * 
  + *
    * The PooledExecutor is static, because presumably these processes will be IO
    * bound, so throwing more than a few threads at them will serve no purpose
    * other than to saturate the IO interface. In light of this, having one thread
    * per region seems unnecessary. This may prove to be false.
  - * 
  + *
    * @author Aaron Smuts
    * @author Travis Savo <ts...@ifilm.com>
  - *  
  + *
    */
   public class PooledCacheEventQueue implements ICacheEventQueue
   {
  -  
  +
     private static final int queueType = POOLED_QUEUE_TYPE;
  -  
  +
     private static final Log log             = LogFactory
                                                  .getLog( PooledCacheEventQueue.class );
   
  @@ -88,7 +88,7 @@
   
     /**
      * Constructor for the CacheEventQueue object
  -   * 
  +   *
      * @param listener
      * @param listenerId
      * @param cacheName
  @@ -136,8 +136,8 @@
     {
       return queueType;
     }
  -  
  -  
  +
  +
     /**
      * Event Q is emtpy.
      */
  @@ -196,13 +196,16 @@
     }
   
     /**
  -   * Event Q is emtpy.
  +   * Destroy the queue.  Interrupt all threads.
      */
     public synchronized void destroy()
     {
       if (!destroyed)
       {
         destroyed = true;
  +      // TODO decide whether to shutdown or interrupt
  +     // pool.getPool().shutdownNow();
  +     pool.getPool().interruptAll();
         log.info( "Cache event queue destroyed: " + this );
       }
     }
  @@ -290,7 +293,7 @@
   
     /**
      * Adds an event to the queue.
  -   * 
  +   *
      * @param event
      */
     private void put( AbstractCacheEvent event )
  @@ -312,7 +315,7 @@
   
     /*
      * (non-Javadoc)
  -   * 
  +   *
      * @see org.apache.jcs.engine.behavior.ICacheEventQueue#getStatistics()
      */
     public IStats getStatistics()
  @@ -352,7 +355,7 @@
           se.setName( "Queue Capacity" );
           se = new StatElement();
           se.setData( "" + bb.capacity() );
  -        elems.add( se );        
  +        elems.add( se );
         }
       }
   
  @@ -377,7 +380,7 @@
   
     /**
      * Retries before declaring failure.
  -   * 
  +   *
      * @author asmuts
      * @created January 15, 2002
      */
  @@ -455,7 +458,7 @@
   
       /**
        * Constructor for the PutEvent object
  -     * 
  +     *
        * @param ice
        * @exception IOException
        */
  @@ -470,7 +473,7 @@
   
       /**
        * Description of the Method
  -     * 
  +     *
        * @exception IOException
        */
       protected void doRun() throws IOException
  @@ -492,7 +495,7 @@
   
     /**
      * Description of the Class
  -   * 
  +   *
      * @author asmuts
      * @created January 15, 2002
      */
  @@ -502,7 +505,7 @@
   
       /**
        * Constructor for the RemoveEvent object
  -     * 
  +     *
        * @param key
        * @exception IOException
        */
  @@ -513,7 +516,7 @@
   
       /**
        * Description of the Method
  -     * 
  +     *
        * @exception IOException
        */
       protected void doRun() throws IOException
  @@ -523,7 +526,7 @@
   
       /*
        * (non-Javadoc)
  -     * 
  +     *
        * @see java.lang.Object#toString()
        */
       public String toString()
  @@ -535,7 +538,7 @@
   
     /**
      * Description of the Class
  -   * 
  +   *
      * @author asmuts
      * @created January 15, 2002
      */
  @@ -544,7 +547,7 @@
   
       /**
        * Description of the Method
  -     * 
  +     *
        * @exception IOException
        */
       protected void doRun() throws IOException
  @@ -554,7 +557,7 @@
   
       /*
        * (non-Javadoc)
  -     * 
  +     *
        * @see java.lang.Object#toString()
        */
       public String toString()
  @@ -566,7 +569,7 @@
   
     /**
      * Description of the Class
  -   * 
  +   *
      * @author asmuts
      * @created January 15, 2002
      */
  @@ -575,7 +578,7 @@
   
       /**
        * Called when gets to the end of the queue
  -     * 
  +     *
        * @exception IOException
        */
       protected void doRun() throws IOException
  @@ -608,16 +611,16 @@
     /**
      * If the Queue is using a bounded channel we can determine the size.
      * If it is zero or we can't determine the size, we return true.
  -   * 
  +   *
      * @return
      */
     public boolean isEmpty()
     {
       if ( pool.getQueue() == null )
       {
  -      return true;      
  +      return pool.getQueue().peek() == null;
       }
  -    else 
  +    else
       {
           if ( pool.getQueue() instanceof BoundedBuffer )
           {
  @@ -626,9 +629,9 @@
           }
           else
           {
  -          return true;                
  +          return true;
           }
       }
     }
   
  -}
  \ No newline at end of file
  +}
  
  
  
  1.8       +5 -3      jakarta-turbine-jcs/src/conf/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/conf/log4j.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- log4j.properties	12 Jan 2005 01:22:36 -0000	1.7
  +++ log4j.properties	13 Jan 2005 09:12:40 -0000	1.8
  @@ -28,7 +28,7 @@
   #log4j.category.org.apache.jcs.acess=WARN,WF
   #log4j.category.org.apache.jcs.engine.control=WARN,WF
   
  -log4j.logger.org.apache.jcs.engine.memory.shrinking=DEBUG
  +#log4j.logger.org.apache.jcs.engine.memory.shrinking=DEBUG
   #log4j.logger.org.apache.jcs.auxiliary.disk=DEBUG
   log4j.logger.org.apache.jcs.auxiliary.disk.indexed=INFO
   
  @@ -37,8 +37,10 @@
   #log4j.category.org.apache.jcs.auxiliary=DEBUG
   #log4j.category.org.apache.jcs.auxiliary.disk=WARN,WF
   #log4j.category.org.apache.jcs.auxiliary.lateral.javagroups=INFO
  -#log4j.category.org.apache.jcs.auxiliary.lateral.xmlrpc=DEBUG,WF
  -log4j.category.org.apache.jcs.auxiliary.remote=INFO,A1,WF
  +#log4j.category.org.apache.jcs.auxiliary.lateral.xmlrpc=DEBUG
  +log4j.category.org.apache.jcs.auxiliary.remote=INFO
  +log4j.category.org.apache.jcs.auxiliary.remote.RemoteCacheListener=DEBUG
  +log4j.category.org.apache.jcs.auxiliary.remote.server=DEBUG
   #log4j.category.org.apache.jcs.utils=WARN,WF
   
   log4j.category.org.apache.jcs.utils=INFO
  
  
  
  1.5       +4 -3      jakarta-turbine-jcs/src/conf/cache2.ccf
  
  Index: cache2.ccf
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/conf/cache2.ccf,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- cache2.ccf	7 Jan 2005 22:27:14 -0000	1.4
  +++ cache2.ccf	13 Jan 2005 09:12:40 -0000	1.5
  @@ -20,6 +20,7 @@
   jcs.region.testCache1.cacheattributes.MaxObjects=1000
   jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
   jcs.region.testCache1.elementattributes.IsLateral=true
  +jcs.region.testCache1.elementattributes.IsRemote=true
   
   jcs.region.testCache2=DC
   jcs.region.testCache2.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
  @@ -47,15 +48,15 @@
   # just a remove lock to add
   jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory
   jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheAttributes
  -jcs.auxiliary.RC.attributes.RemoteHost=10.21.209.150
  -jcs.auxiliary.RC.attributes.RemotePort=1102
  -#jcs.auxiliary.RC.attributes.LocalPort=1103
  +jcs.auxiliary.RC.attributes.FailoverServers=localhost:1102
  +jcs.auxiliary.RC.attributes.LocalPort=1104
   jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false
   #jcs.auxiliary.RC.attributes.RemoteServiceName=RemoteCache
   #-1 means no timeout, this is the default
   # if the timeout is -1, no threadpool will be used.
   jcs.auxiliary.RC.attributes.GetTimeoutMillis=5000
   jcs.auxiliary.RC.attributes.ThreadPoolName=remote_cache_client
  +jcs.auxiliary.RC.attributes.GetOnly=false
   
   # unreliable
   jcs.auxiliary.LUDP=org.apache.jcs.auxiliary.lateral.LateralCacheFactory
  
  
  
  1.14      +2 -2      jakarta-turbine-jcs/src/conf/cache.ccf
  
  Index: cache.ccf
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/conf/cache.ccf,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- cache.ccf	12 Jan 2005 01:21:58 -0000	1.13
  +++ cache.ccf	13 Jan 2005 09:12:40 -0000	1.14
  @@ -10,7 +10,7 @@
   jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
   jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
   jcs.default.elementattributes.IsEternal=false
  -jcs.default.elementattributes.MaxLifeSeconds=7
  +jcs.default.elementattributes.MaxLifeSeconds=700
   jcs.default.elementattributes.IdleTime=1800
   jcs.default.elementattributes.IsSpool=true
   jcs.default.elementattributes.IsRemote=true
  @@ -133,7 +133,7 @@
   jcs.auxiliary.RC.attributes.FailoverServers=localhost:1102
   #jcs.auxiliary.RC.attributes.RemoteHost=localhost
   #jcs.auxiliary.RC.attributes.RemotePort=1102
  -#jcs.auxiliary.RC.attributes.LocalPort=1103
  +jcs.auxiliary.RC.attributes.LocalPort=1103
   jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false
   #jcs.auxiliary.RC.attributes.RemoteServiceName=RemoteCache
   #-1 means no timeout, this is the default
  
  
  
  1.11      +14 -14    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
  
  Index: LateralCacheNoWait.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- LateralCacheNoWait.java	7 Jan 2005 22:27:54 -0000	1.10
  +++ LateralCacheNoWait.java	13 Jan 2005 09:12:40 -0000	1.11
  @@ -63,12 +63,12 @@
     public LateralCacheNoWait( LateralCache cache )
     {
       this.cache = cache;
  -    
  -    CacheEventQueueFactory fact = new CacheEventQueueFactory();   
  +
  +    CacheEventQueueFactory fact = new CacheEventQueueFactory();
       this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ),
                                     LateralCacheInfo.listenerId,
  -                                  cache.getCacheName(),                                                    
  -                                  cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), 
  +                                  cache.getCacheName(),
  +                                  cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
                                     cache.getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
   
       // need each no wait to handle each of its real updates and removes, since there may
  @@ -203,7 +203,7 @@
      */
     public int getStatus()
     {
  -    return q.isAlive() ? cache.getStatus() : CacheConstants.STATUS_ERROR;
  +    return q.isWorking() ? cache.getStatus() : CacheConstants.STATUS_ERROR;
     }
   
     /**
  @@ -218,7 +218,7 @@
   
     /**
      * Replaces the lateral cache service handle with the given handle and reset
  -   * the event queue by starting up a new instance.
  +   * the queue by starting up a new instance.
      */
     public void fixCache( ILateralCacheService lateral )
     {
  @@ -233,15 +233,15 @@
      */
     public void resetEventQ()
     {
  -    if ( q.isAlive() )
  +    if ( q.isWorking() )
       {
         q.destroy();
       }
  -    CacheEventQueueFactory fact = new CacheEventQueueFactory();   
  +    CacheEventQueueFactory fact = new CacheEventQueueFactory();
       this.q = fact.createCacheEventQueue( new CacheAdaptor( cache ),
                                     LateralCacheInfo.listenerId,
  -                                  cache.getCacheName(),                                                    
  -                                  cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(), 
  +                                  cache.getCacheName(),
  +                                  cache.getAuxiliaryCacheAttributes().getEventQueuePoolName(),
                                     cache.getAuxiliaryCacheAttributes().getEventQueueTypeFactoryCode() );
     }
   
  @@ -260,10 +260,10 @@
     {
       return getStatistics().toString();
     }
  -  
  +
     /*
      * (non-Javadoc)
  -   * 
  +   *
      * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatistics()
      */
     public IStats getStatistics()
  @@ -283,11 +283,11 @@
   	IStatElement[] eqSEs = eqStats.getStatElements();
   	List eqL = Arrays.asList(eqSEs);
   	elems.addAll( eqL );
  -        
  +
       // get an array and put them in the Stats object
       IStatElement[] ses = (IStatElement[]) elems.toArray( new StatElement[0] );
       stats.setStatElements( ses );
   
       return stats;
  -  }   
  +  }
   }
  
  
  
  1.1                  jakarta-turbine-jcs/tempbuild/jcs-1.2.1-dev.jar
  
  	<<Binary file>>
  
  
  1.8       +21 -12    jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java
  
  Index: ICacheEventQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/behavior/ICacheEventQueue.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ICacheEventQueue.java	7 Jan 2005 22:27:54 -0000	1.7
  +++ ICacheEventQueue.java	13 Jan 2005 09:12:42 -0000	1.8
  @@ -31,25 +31,25 @@
   public interface ICacheEventQueue
   {
   
  -  
  +
     /**
  -   * Does not use a thread pool.  
  +   * Does not use a thread pool.
      */
     public static final int SINGLE_QUEUE_TYPE = 0;
  -  
  +
     /**
      * Uses a thread pool
      */
  -  public static final int POOLED_QUEUE_TYPE = 1;  
  -  
  -  
  +  public static final int POOLED_QUEUE_TYPE = 1;
  +
  +
     /**
      * Returnt he type of event queue we are using, either single or pooled.
  -   * 
  +   *
      * @return
      */
     public abstract int getQueueType();
  -  
  +
       /**
        * Adds a feature to the PutEvent attribute of the ICacheEventQueue object
        *
  @@ -98,17 +98,26 @@
   
   
       /**
  -     * Gets the alive attribute of the ICacheEventQueue object
  +     * Gets the alive attribute of the ICacheEventQueue object.
  +     * Alive just indicates that there are active threads.  This
  +     * is less important that if the queue is working.
        *
        * @return The alive value
        */
       public boolean isAlive();
   
       /**
  +     *  A Queue is working unless it has reached its max failure count.
  +     *
  +     * @return boolean
  +     */
  +    public boolean isWorking();
  +
  +    /**
        * Returns the historical and statistical data for an event queue cache.
  -     * 
  -     * @return 
  +     *
  +     * @return
        */
  -    public IStats getStatistics();   
  +    public IStats getStatistics();
   }
   
  
  
  
  1.19      +2 -1      jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCache.java
  
  Index: CompositeCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCache.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CompositeCache.java	6 Jan 2005 04:44:28 -0000	1.18
  +++ CompositeCache.java	13 Jan 2005 09:12:42 -0000	1.19
  @@ -861,6 +861,7 @@
                   // have 'getUseLateral' set, all the elements currently in
                   // memory are written to the lateral before disposing
   
  +                //TODO make sure disk gets a change to finish
                   if ( aux.getCacheType() != ICacheType.LATERAL_CACHE
                        || this.cacheAttr.getUseLateral() )
                   {
  
  
  
  1.3       +3 -2      jakarta-turbine-jcs/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/disk/bdbje/BDBJECacheAttributes.java
  
  Index: BDBJECacheAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/disk/bdbje/BDBJECacheAttributes.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BDBJECacheAttributes.java	7 Jan 2005 22:27:14 -0000	1.2
  +++ BDBJECacheAttributes.java	13 Jan 2005 09:12:43 -0000	1.3
  @@ -19,12 +19,13 @@
   import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
   import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
   import org.apache.jcs.auxiliary.disk.bdbje.behavior.IBDBJECacheAttributes;
  +import org.apache.jcs.auxiliary.disk.AbstractDiskCacheAttributes;
   
   /**
    *  Attributes for Berkeley DB JE disk cache auxiliary.
    */
  -public class BDBJECacheAttributes extends AbstractAuxiliaryCacheAttributes
  -    implements AuxiliaryCacheAttributes, IBDBJECacheAttributes
  +public class BDBJECacheAttributes extends AbstractDiskCacheAttributes
  +    implements IBDBJECacheAttributes
   {
     private String diskPath;
   
  
  
  
  1.3       +2 -1      jakarta-turbine-jcs/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/disk/bdbje/BDBJECache.java
  
  Index: BDBJECache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/auxiliary-builds/jdk14/src/java/org/apache/jcs/auxiliary/disk/bdbje/BDBJECache.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BDBJECache.java	7 Jan 2005 22:27:14 -0000	1.2
  +++ BDBJECache.java	13 Jan 2005 09:12:43 -0000	1.3
  @@ -25,6 +25,7 @@
   import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
   import org.apache.jcs.auxiliary.disk.AbstractDiskCache;
   import org.apache.jcs.engine.behavior.ICacheElement;
  +import org.apache.jcs.auxiliary.disk.behavior.IDiskCacheAttributes;
   
   /**
    *  One BDBJECache per regions.  For now they share one underlying Berekeley DB.
  @@ -41,7 +42,7 @@
   
     public BDBJECache( BDBJECacheAttributes attr )
     {
  -    super( (AuxiliaryCacheAttributes)attr );
  +    super( (IDiskCacheAttributes)attr );
       this.je = new BDBJE( attr );
       if ( log.isDebugEnabled() )
       {
  
  
  
  1.4       +3 -0      jakarta-turbine-jcs/xdocs/BasicJCSConfiguration.xml
  
  Index: BasicJCSConfiguration.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/xdocs/BasicJCSConfiguration.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicJCSConfiguration.xml	12 Jan 2005 01:22:35 -0000	1.3
  +++ BasicJCSConfiguration.xml	13 Jan 2005 09:12:44 -0000	1.4
  @@ -41,6 +41,7 @@
   jcs.default.cacheattributes.cacheattributes.UseMemoryShrinker=true
   jcs.default.cacheattributes.cacheattributes.MaxMemoryIdleTimeSeconds=3600
   jcs.default.cacheattributes.cacheattributes.ShrinkerIntervalSeconds=60
  +jcs.default.cacheattributes.MaxSpoolPerRun=500
           ]]></source>
           <p>
             Adding a <a href="IndexedDiskAuxCache.html">disk cache</a> is
  @@ -76,6 +77,7 @@
   jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
   jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
   jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
  +jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
           ]]></source>
           <p>
             If you want to add a lateral cache for distribution (the <a
  @@ -141,6 +143,7 @@
   jcs.region.testCache1.cacheattributes.UseMemoryShrinker=true
   jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=3600
   jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=60
  +jcs.region.testCache1.cacheattributes.MaxSpoolPerRun=500
   
   # AVAILABLE AUXILIARY CACHES   
   jcs.auxiliary.DC=
  
  
  
  1.26      +25 -24    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java
  
  Index: AbstractDiskCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AbstractDiskCache.java	12 Jan 2005 01:21:54 -0000	1.25
  +++ AbstractDiskCache.java	13 Jan 2005 09:12:44 -0000	1.26
  @@ -66,10 +66,10 @@
       private static final Log log =
           LogFactory.getLog( AbstractDiskCache.class );
   
  -    
  +
       /**  Generic disk cache attributes */
       private IDiskCacheAttributes dcattr = null;
  -    
  +
       /**
        * Map where elements are stored between being added to this cache and
        * actually spooled to disk. This allows puts to the disk cache to return
  @@ -118,44 +118,44 @@
       public AbstractDiskCache( IDiskCacheAttributes attr )
       {
         	this.dcattr = attr;
  -      
  +
           this.cacheName = attr.getCacheName();
   
           CacheEventQueueFactory fact = new CacheEventQueueFactory();
           this.cacheEventQueue = fact.createCacheEventQueue( new MyCacheListener(),
                                                       CacheInfo.listenerId,
  -                                                    cacheName, 
  -                                                    dcattr.getEventQueuePoolName(), 
  +                                                    cacheName,
  +                                                    dcattr.getEventQueuePoolName(),
                                                       dcattr.getEventQueueTypeFactoryCode() );
  -        
  +
           initPurgatory();
       }
   
  -    
  +
       /**
        * Purgatory size of -1 means to use a HashMap with no size limit.
        * Anything greater will use an LRU map of some sort.
  -     * 
  +     *
        * @TODO Currently setting this to 0 will cause nothing to be put to disk, since it
  -     * will assume that if an item is not in purgatory, then it must have been plucked.  
  +     * will assume that if an item is not in purgatory, then it must have been plucked.
        * We should make 0 work, a way to not use purgatory.
  -     * 
  +     *
        *
        */
       private void initPurgatory()
       {
         purgatory = null;
  -      
  +
         if ( dcattr.getMaxPurgatorySize() >= 0 )
         {
  -        purgatory = new LRUMapJCS( dcattr.getMaxPurgatorySize() );              
  +        purgatory = new LRUMapJCS( dcattr.getMaxPurgatorySize() );
         }
  -      else 
  +      else
         {
           purgatory = new HashMap();
         }
       }
  -    
  +
       // ------------------------------------------------------- interface ICache
   
       /**
  @@ -318,7 +318,8 @@
       {
   
          // FIXME: May lose the end of the queue, need to be more graceful
  -        cacheEventQueue.destroy();
  +       // call finish up or something first
  +       cacheEventQueue.destroy();
   
           // Invoke any implementation specific disposal code
           doDispose();
  @@ -353,35 +354,35 @@
       {
       	IStats stats = new Stats();
       	stats.setTypeName( "Abstract Disk Cache" );
  -    	
  +
       	ArrayList elems = new ArrayList();
  -    	
  +
       	IStatElement se = null;
  -    	
  +
       	se = new StatElement();
       	se.setName( "Purgatory Hits" );
       	se.setData("" + purgHits);
       	elems.add(se);
  -    	
  +
       	se.setName( "Purgatory Size" );
       	se = new StatElement();
       	se.setData("" + purgatory.size());
       	elems.add(se);
  -    	
  +
       	// get the stats from the event queue too
       	// get as array, convert to list, add list to our outer list
       	IStats eqStats = this.cacheEventQueue.getStatistics();
       	IStatElement[] eqSEs = eqStats.getStatElements();
       	List eqL = Arrays.asList(eqSEs);
   		elems.addAll( eqL );
  -    	
  +
       	// get an array and put them in the Stats object
       	IStatElement[] ses = (IStatElement[])elems.toArray( new StatElement[0] );
       	stats.setStatElements( ses );
   
       	return stats;
  -    }     
  -    
  +    }
  +
       /**
        * @see ICache#getStatus
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-dev-help@jakarta.apache.org