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/03/04 06:20:54 UTC

cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control CompositeCacheManager.java

asmuts      2005/03/03 21:20:54

  Modified:    src/java/org/apache/jcs/auxiliary/disk/indexed
                        IndexedDiskCacheAttributes.java
               src/java/org/apache/jcs/engine ElementAttributes.java
               src/java/org/apache/jcs/engine/control
                        CompositeCacheManager.java
  Log:
  Fixed three problems found by Peter Bugla:
  1.  props file  not getting set in manager configure( Properties)
  2.  getTimeToLiveSeconds was returning millis, but nothing uses this method.
  3.  The recycle bin size and the max size were dependent on the order in the file.  Stopped linking the two.
  
  updating to 1.2.5-dev
  
  Revision  Changes    Path
  1.14      +13 -20    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java
  
  Index: IndexedDiskCacheAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCacheAttributes.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- IndexedDiskCacheAttributes.java	1 Feb 2005 00:01:58 -0000	1.13
  +++ IndexedDiskCacheAttributes.java	4 Mar 2005 05:20:53 -0000	1.14
  @@ -25,18 +25,18 @@
    * Configuration class for the Indexed Disk Cache
    *
    */
  -public class IndexedDiskCacheAttributes extends AbstractDiskCacheAttributes 
  -{   
  -  
  +public class IndexedDiskCacheAttributes extends AbstractDiskCacheAttributes
  +{
  +
       private static final int DEFAULT_maxKeySize = 5000;
       private static final int DEFAULT_maxRecycleBinSize = 5000;
  -  
  +
       /** -1 mean no limit. */
       private int maxKeySize = DEFAULT_maxKeySize;
   
       /** Cannot be larger than the max size.  If max is less than 0, this will be 5000 */
       private int maxRecycleBinSize = DEFAULT_maxRecycleBinSize;
  -    
  +
       // default to -1, i.e., don't optimize until shutdown
       private int optimizeAtRemoveCount = -1;
   
  @@ -45,9 +45,9 @@
        */
       public IndexedDiskCacheAttributes()
       {
  -    } 
  +    }
  +
   
  -    
       /**
        * Gets the maxKeySize attribute of the DiskCacheAttributes object
        *
  @@ -61,13 +61,13 @@
   
       /**
        * Sets the maxKeySize attribute of the DiskCacheAttributes object
  -     * 
  +     *
        * @param maxKeySize The new maxKeySize value
        */
       public void setMaxKeySize( int maxKeySize )
       {
           this.maxKeySize = maxKeySize;
  -        
  +
           // make sure the sizes are in accord with our rule.
           setMaxRecycleBinSize( maxRecycleBinSize );
       }
  @@ -100,22 +100,15 @@
        * This cannot be larger than the maxKeySize.  It wouldn't hurt
        * anything, but it makes the config necessary.  The recycle bin
        * entry willbe at least as large as a key.
  -     * 
  +     *
        * If the maxKeySize
        * is -1 this will be set tot he default, which is 5000.
  -     * 
  +     *
        * @param maxRecycleBinSize The maxRecycleBinSize to set.
        */
       public void setMaxRecycleBinSize( int maxRecycleBinSize )
       {
  -      if ( maxKeySize >= 0 )
  -      {
  -        this.maxRecycleBinSize = Math.min( maxRecycleBinSize, maxKeySize );
  -      }
  -      else
  -      {
  -        this.maxRecycleBinSize = DEFAULT_maxRecycleBinSize;        
  -      }
  +      this.maxRecycleBinSize =  maxRecycleBinSize;
       }
   
   
  @@ -127,7 +120,7 @@
         return maxRecycleBinSize;
       }
   
  -    
  +
       /**
        * Description of the Method
        *
  
  
  
  1.9       +33 -32    jakarta-turbine-jcs/src/java/org/apache/jcs/engine/ElementAttributes.java
  
  Index: ElementAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/ElementAttributes.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ElementAttributes.java	1 Feb 2005 00:01:58 -0000	1.8
  +++ ElementAttributes.java	4 Mar 2005 05:20:53 -0000	1.9
  @@ -31,7 +31,7 @@
   
   /**
    * Element attribute descriptor class.
  - * 
  + *
    * @version $Id: ILateralCacheTCPListener.java,v 1.2 2002/01/18 22:08:26
    */
   public class ElementAttributes implements IElementAttributes, Serializable,
  @@ -111,7 +111,7 @@
   
       /**
        * Constructor for the IElementAttributes object
  -     * 
  +     *
        * @param attr
        */
       private ElementAttributes(ElementAttributes attr)
  @@ -139,7 +139,7 @@
   
       /**
        * Copies the attributes, including references to event handlers.
  -     * 
  +     *
        * @return a copy of the Attributes
        */
       public IElementAttributes copy()
  @@ -167,7 +167,7 @@
   
       /**
        * Deep clone the attributes.
  -     * 
  +     *
        * @return a clone of these attributes
        */
       public Object clone2()
  @@ -199,7 +199,7 @@
   
       /**
        * Sets the version attribute of the IElementAttributes object
  -     * 
  +     *
        * @param version
        *            The new version value
        */
  @@ -210,7 +210,7 @@
   
       /**
        * Sets the maxLifeSeconds attribute of the IElementAttributes object
  -     * 
  +     *
        * @param mls
        *            The new {3} value
        */
  @@ -221,7 +221,7 @@
   
       /**
        * Gets the {3} attribute of the ElementAttributes object
  -     * 
  +     *
        * @return The {3} value
        */
       public long getMaxLifeSeconds()
  @@ -231,7 +231,7 @@
   
       /**
        * Sets the idleTime attribute of the IElementAttributes object
  -     * 
  +     *
        * @param idle
        *            The new idleTime value
        */
  @@ -244,7 +244,7 @@
   
       /**
        * Size in bytes.
  -     * 
  +     *
        * @param size
        *            The new size value
        */
  @@ -255,7 +255,7 @@
   
       /**
        * Gets the size attribute of the IElementAttributes object
  -     * 
  +     *
        * @return The size value
        */
       public int getSize()
  @@ -265,7 +265,7 @@
   
       /**
        * Gets the createTime attribute of the IElementAttributes object
  -     * 
  +     *
        * @return The createTime value
        */
       public long getCreateTime()
  @@ -283,7 +283,7 @@
   
       /**
        * Gets the version attribute of the IElementAttributes object
  -     * 
  +     *
        * @return The version value
        */
       public long getVersion()
  @@ -295,7 +295,7 @@
        * Gets the idleTime attribute of the IElementAttributes object. Keeping
        * track of this will require storing the last access time. This could get
        * expensive.
  -     * 
  +     *
        * @return The idleTime value
        */
       public long getIdleTime()
  @@ -305,18 +305,19 @@
   
       /**
        * If the returned value is negative, the item has expired
  -     * 
  +     *
        * @return The timeToLive value
        */
       public long getTimeToLiveSeconds()
       {
           long now = System.currentTimeMillis();
  -        return (this.getCreateTime() + (this.getMaxLifeSeconds() * 1000)) - now;
  +        return ((this.getCreateTime() + (this.getMaxLifeSeconds()
  +                                         * 1000)) - now) / 1000;
       }
   
       /**
        * Gets the LastAccess attribute of the IAttributes object
  -     * 
  +     *
        * @return The LastAccess value
        */
       public long getLastAccessTime()
  @@ -334,7 +335,7 @@
   
       /**
        * Gets the {3} attribute of the IElementAttributes object
  -     * 
  +     *
        * @return The {3} value
        */
       public boolean getIsDistribute()
  @@ -344,7 +345,7 @@
   
       /**
        * Sets the isDistribute attribute of the ElementAttributes object
  -     * 
  +     *
        * @param val
        *            The new isDistribute value
        */
  @@ -355,7 +356,7 @@
   
       /**
        * can this item be flushed to disk
  -     * 
  +     *
        * @return The {3} value
        */
       public boolean getIsSpool()
  @@ -365,7 +366,7 @@
   
       /**
        * Sets the isSpool attribute of the ElementAttributes object
  -     * 
  +     *
        * @param val
        *            The new isSpool value
        */
  @@ -376,7 +377,7 @@
   
       /**
        * Is this item laterally distributable
  -     * 
  +     *
        * @return The {3} value
        */
       public boolean getIsLateral()
  @@ -386,7 +387,7 @@
   
       /**
        * Sets the isLateral attribute of the ElementAttributes object
  -     * 
  +     *
        * @param val
        *            The new isLateral value
        */
  @@ -397,7 +398,7 @@
   
       /**
        * Can this item be sent to the remote cache
  -     * 
  +     *
        * @return The {3} value
        */
       public boolean getIsRemote()
  @@ -407,7 +408,7 @@
   
       /**
        * Sets the isRemote attribute of the ElementAttributes object
  -     * 
  +     *
        * @param val
        *            The new isRemote value
        */
  @@ -418,7 +419,7 @@
   
       /**
        * can turn off expiration
  -     * 
  +     *
        * @return The {3} value
        */
       public boolean getIsEternal()
  @@ -428,7 +429,7 @@
   
       /**
        * Sets the isEternal attribute of the ElementAttributes object
  -     * 
  +     *
        * @param val
        *            The new isEternal value
        */
  @@ -440,11 +441,11 @@
       /**
        * Adds a ElementEventHandler. Handler's can be registered for multiple
        * events. A registered handler will be called at every recognized event.
  -     * 
  +     *
        * The alternative would be to register handlers for each event. Or maybe
        * The handler interface should have a method to return whether it cares
        * about certain events.
  -     * 
  +     *
        * @param eventHandler
        *            The ElementEventHandler to be added to the list.
        */
  @@ -460,7 +461,7 @@
   
       /**
        * Sets the eventHandlers of the IElementAttributes object
  -     * 
  +     *
        * @param eventHandlers
        *            value
        */
  @@ -480,7 +481,7 @@
       /**
        * Gets the elementEventHandlers. Returns null if none exist. Makes checking
        * easy.
  -     * 
  +     *
        * @return The elementEventHandlers value
        */
   
  @@ -491,7 +492,7 @@
   
       /**
        * For logging and debugging the element IElementAttributes.
  -     * 
  +     *
        * @return String info about the values.
        */
       public String toString()
  @@ -513,4 +514,4 @@
   
           return dump.toString();
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.13      +2 -0      jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java
  
  Index: CompositeCacheManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/engine/control/CompositeCacheManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CompositeCacheManager.java	6 Jan 2005 04:44:28 -0000	1.12
  +++ CompositeCacheManager.java	4 Mar 2005 05:20:53 -0000	1.13
  @@ -210,6 +210,8 @@
               new CompositeCacheConfigurator( this );
   
           configurator.doConfigure( props );
  +
  +        this.props = props;
       }
   
       /**
  
  
  

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