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/06 05:44:28 UTC

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

asmuts      2005/01/05 20:44:28

  Modified:    src/java/org/apache/jcs/utils/threadpool
                        ThreadPoolManager.java PoolConfiguration.java
               src/java/org/apache/jcs/auxiliary/remote/server
                        RemoteCacheServer.java
               src/java/org/apache/jcs/auxiliary/remote RemoteCache.java
               src/conf remote.cache.ccf log4j.properties cache.ccf
               src/test-conf log4j.properties
               tempbuild jcs-1.1.3-dev.jar
               src/java/org/apache/jcs/engine/control
                        CompositeCacheManager.java CompositeCache.java
  Log:
  Fixed bug in new code where the future result was not getting returned.
  Added get statis method to CompositeCacheManager.
  Added license to threadpool management classes.
  Updated temp build jar, smae version as earlier.
  
  Revision  Changes    Path
  1.2       +39 -23    jakarta-turbine-jcs/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
  
  Index: ThreadPoolManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ThreadPoolManager.java	6 Jan 2005 01:19:51 -0000	1.1
  +++ ThreadPoolManager.java	6 Jan 2005 04:44:27 -0000	1.2
  @@ -1,5 +1,21 @@
   package org.apache.jcs.utils.threadpool;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License")
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   import java.io.IOException;
   import java.io.InputStream;
   import java.util.ArrayList;
  @@ -18,32 +34,32 @@
    * This manages threadpools for an application using Doug Lea's Util Concurrent
    * package.
    * http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html
  - * 
  + *
    * It is a singleton since threads need to be managed vm wide.
  - * 
  + *
    * This managers force you to use a bounded queue. By default it uses the
    * current thread for execuion when the buffer is full and no free threads can
    * be created.
  - * 
  + *
    * You can specify the props file to use or pass in a properties object prior to
    * configuration. By default it looks for configuration information in
    * thread_pool.properties.
  - * 
  + *
    * If set the Properties object will take precedence.
  - * 
  + *
    * If a value is not set for a particular pool, the hard coded defaults will be
    * used.
  - * 
  + *
    * int boundarySize_DEFAULT = 75; int maximumPoolSize_DEFAULT = 150; int
    * minimumPoolSize_DEFAULT = 4; int keepAliveTime_DEFAULT = 1000 * 60 * 5;
    * boolean abortWhenBlocked = false; int startUpSize_DEFAULT = 4;
  - * 
  - * 
  + *
  + *
    * You can configure default settings by specifying a default pool in the
    * properties, ie "cache.ccf"
  - * 
  + *
    * @author Aaron Smuts
  - *  
  + *
    */
   public class ThreadPoolManager
   {
  @@ -88,7 +104,7 @@
   
     /**
      * No instances please. This is a singleton.
  -   *  
  +   *
      */
     private ThreadPoolManager()
     {
  @@ -97,7 +113,7 @@
   
     /**
      * Creates a pool based on the configuration info.
  -   * 
  +   *
      * @param config
      * @return
      */
  @@ -125,7 +141,7 @@
      * Returns a configured instance of the ThreadPoolManger To specify a
      * configuation file or Properties object to use call the appropriate setter
      * prior to calling getInstance.
  -   * 
  +   *
      * @return
      */
     public static synchronized ThreadPoolManager getInstance()
  @@ -141,10 +157,10 @@
      * Returns a pool by name. If a pool by this name does not exist in the
      * configuration file or properties, one will be created using the default
      * values.
  -   * 
  +   *
      * Pools are lazily created.
  -   * 
  -   * 
  +   *
  +   *
      * @param name
      * @return
      */
  @@ -182,7 +198,7 @@
   
     /**
      * returns the names of all configured pools.
  -   * 
  +   *
      * @return ArrayList of string names
      */
     public ArrayList getPoolNames()
  @@ -202,7 +218,7 @@
   
     /**
      * Setting this post initialization will have no effect.
  -   * 
  +   *
      * @param propsFileName
      *          The propsFileName to set.
      */
  @@ -212,7 +228,7 @@
     }
   
     /**
  -   * 
  +   *
      * @return Returns the propsFileName.
      */
     public static String getPropsFileName()
  @@ -223,7 +239,7 @@
     /**
      * This will be used if it is not null on initialzation. Setting this post
      * initialization will have no effect.
  -   * 
  +   *
      * @param props
      *          The props to set.
      */
  @@ -245,7 +261,7 @@
     /**
      * Intialize the ThreadPoolManager and create all the pools defined in the
      * configuration.
  -   *  
  +   *
      */
     private void configure()
     {
  @@ -305,7 +321,7 @@
   
     /**
      * Configures the default PoolConfiguration settings
  -   *  
  +   *
      */
     private PoolConfiguration loadConfig( String root )
     {
  @@ -399,4 +415,4 @@
       return config;
     }
   
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +21 -5     jakarta-turbine-jcs/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
  
  Index: PoolConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PoolConfiguration.java	6 Jan 2005 01:21:04 -0000	1.1
  +++ PoolConfiguration.java	6 Jan 2005 04:44:27 -0000	1.2
  @@ -1,10 +1,26 @@
   package org.apache.jcs.utils.threadpool;
   
  +/*
  + * Copyright 2001-2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License")
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + *
  + *     http://www.apache.org/licenses/LICENSE-2.0
  + *
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + */
  +
   /**
    * This object holds configuration data for a thread pool.
  - * 
  + *
    * @author Aaron Smuts
  - *  
  + *
    */
   public class PoolConfiguration implements Cloneable
   {
  @@ -22,7 +38,7 @@
   
     /**
      * Default
  -   *  
  +   *
      */
     public PoolConfiguration()
     {
  @@ -30,7 +46,7 @@
     }
   
     /**
  -   * 
  +   *
      * @param boundarySize
      * @param maximumPoolSize
      * @param minimumPoolSize
  @@ -169,4 +185,4 @@
       return new PoolConfiguration( boundarySize, maximumPoolSize,
           minimumPoolSize, keepAliveTime, abortWhenBlocked, startUpSize );
     }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.19      +2 -2      jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java
  
  Index: RemoteCacheServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RemoteCacheServer.java	16 Nov 2004 07:39:40 -0000	1.18
  +++ RemoteCacheServer.java	6 Jan 2005 04:44:28 -0000	1.19
  @@ -873,8 +873,8 @@
       public String getStats()
           throws IOException
       {
  -        //return cacheManager.getStats();
  -        return "temp";
  +        return cacheManager.getStats();
  +        //return "temp";
       }
   
       /** Description of the Method */
  
  
  
  1.13      +40 -23    jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
  
  Index: RemoteCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- RemoteCache.java	6 Jan 2005 01:26:38 -0000	1.12
  +++ RemoteCache.java	6 Jan 2005 04:44:28 -0000	1.13
  @@ -69,7 +69,7 @@
   
       private PooledExecutor pool = null;
       private boolean usePoolForGet = false;
  -    
  +
       /** Description of the Method */
       public String toString()
       {
  @@ -95,14 +95,14 @@
               log.debug( "Construct> cacheName=" + cattr.getCacheName() );
               log.debug( "irca = " + irca.toString() );
           }
  -        
  +
           // use a pool if it is greater than 0
           if ( log.isDebugEnabled() )
           {
             log.debug( "GetTimeoutMillis() = " + irca.getGetTimeoutMillis() );
           }
           if ( irca.getGetTimeoutMillis() > 0 )
  -        { 
  +        {
             pool = ThreadPoolManager.getInstance().getPool( irca.getThreadPoolName() );
             if ( log.isDebugEnabled() )
             {
  @@ -113,7 +113,7 @@
               usePoolForGet = true;
             }
           }
  -        
  +
           /*
            * TODO
            * should be done by the remote cache, not the job of the hub manager
  @@ -165,7 +165,11 @@
               {
                   try
                   {
  -                    remote.update( ce, RemoteCacheInfo.listenerId );
  +                  if ( log.isDebugEnabled() )
  +                  {
  +                    log.debug( "sending item to remote server" );
  +                  }
  +                  remote.update( ce, RemoteCacheInfo.listenerId );
                   }
                   catch ( NullPointerException npe )
                   {
  @@ -180,7 +184,10 @@
               }
               else
               {
  -                //p( "get only mode, irca = " + irca.toString() );
  +                if ( log.isDebugEnabled() )
  +                {
  +                  log.debug( "get only mode, not sending to remote server" );
  +                }
               }
           }
       }
  @@ -189,7 +196,7 @@
       /**
        * Synchronously get from the remote cache; if failed, replace the remote
        * handle with a zombie.
  -     * 
  +     *
        * Use threadpool to timeout is a value is set for GetTimeoutMillis
        */
       public ICacheElement get( Serializable key )
  @@ -199,11 +206,11 @@
           {
               if ( usePoolForGet )
               {
  -              return getUsingPool( key );
  +              return getUsingPool( sanitized( key ) );
               }
  -            else 
  +            else
               {
  -              return remote.get( cacheName, sanitized( key ) );              
  +              return remote.get( cacheName, sanitized( key ) );
               }
           }
           catch ( ObjectNotFoundException one )
  @@ -220,10 +227,10 @@
           }
       }
   
  -    
  +
       /**
        * This allows gets to timeout in case of remote server machine shutdown.
  -     * 
  +     *
        * @param key
        * @return
        * @throws IOException
  @@ -254,12 +261,24 @@
             }
           }
         } );
  -      
  +
         // execute using the pool
         pool.execute( command );
   
         // used timed get in order to timeout
  -      future.timedGet( timeout );
  +      ICacheElement ice = (ICacheElement)future.timedGet( timeout );
  +      if ( log.isDebugEnabled() )
  +      {
  +        if ( ice == null )
  +        {
  +          log.debug( "nothing found in remote cache" );
  +        }
  +        else
  +        {
  +          log.debug( "found item in remote cache" );
  +        }
  +      }
  +      return ice;
       }
       catch (InterruptedException ex)
       {
  @@ -272,10 +291,8 @@
         log.error( "Assuming an IO exception thrown in the backfground.", ex );
         throw new IOException( "Get Request timed out after " + timeout );
       }
  -
  -    return null;
     }
  -    
  +
       public Set getGroupKeys(String groupName) throws java.rmi.RemoteException
       {
           return remote.getGroupKeys(cacheName, groupName);
  @@ -406,10 +423,10 @@
           return getStatistics().toString();
       }
   
  -    
  +
       /*
        * (non-Javadoc)
  -     * 
  +     *
        * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatistics()
        */
       public IStats getStatistics()
  @@ -424,7 +441,7 @@
         // no data gathered here
         se = new StatElement();
         se.setName( "UsePoolForGet" );
  -      se.setData( "" + usePoolForGet );      
  +      se.setData( "" + usePoolForGet );
         elems.add( se );
   
         if ( pool != null )
  @@ -432,12 +449,12 @@
       	se = new StatElement();
          	se.setName( "Pool Size" );
       	se.setData("" + pool.getPoolSize() );
  -    	elems.add(se);   	
  +    	elems.add(se);
   
       	se = new StatElement();
       	se.setName( "Maximum Pool Size" );
       	se.setData("" + pool.getMaximumPoolSize() );
  -    	elems.add(se);   	     
  +    	elems.add(se);
         }
   
         // get an array and put them in the Stats object
  @@ -445,7 +462,7 @@
         stats.setStatElements( ses );
   
         return stats;
  -    }       
  +    }
       /**
        * Returns the current cache size.
        *
  
  
  
  1.4       +2 -2      jakarta-turbine-jcs/src/conf/remote.cache.ccf
  
  Index: remote.cache.ccf
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/conf/remote.cache.ccf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- remote.cache.ccf	7 Nov 2003 02:02:18 -0000	1.3
  +++ remote.cache.ccf	6 Jan 2005 04:44:28 -0000	1.4
  @@ -17,7 +17,7 @@
   # sets the default aux value for any non configured caches
   jcs.default=DC
   jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
  -jcs.default.cacheattributes.MaxObjects=1000
  +jcs.default.cacheattributes.MaxObjects=10000
   jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
   jcs.default.cacheattributes.UseMemoryShrinker=true
   jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
  @@ -50,7 +50,7 @@
   ################## CACHE REGIONS AVAILABLE ###################
   jcs.region.testCache1=DC,RCluster1
   jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
  -jcs.region.testCache1.cacheattributes.MaxObjects=1000
  +jcs.region.testCache1.cacheattributes.MaxObjects=10000
   
   
   ##############################################################
  
  
  
  1.6       +4 -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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- log4j.properties	6 Jan 2005 01:21:04 -0000	1.5
  +++ log4j.properties	6 Jan 2005 04:44:28 -0000	1.6
  @@ -34,10 +34,11 @@
   
   #log4j.category.org.apache.jcs.config=WARN,A1
   
  +#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.javagroups=INFO
   #log4j.category.org.apache.jcs.auxiliary.lateral.xmlrpc=DEBUG,WF
  -log4j.category.org.apache.jcs.auxiliary.remote=DEBUG,WF
  +log4j.category.org.apache.jcs.auxiliary.remote=INFO,A1,WF
   #log4j.category.org.apache.jcs.utils=WARN,WF
   
  -log4j.category.org.apache.jcs.utils=DEBUG
  +log4j.category.org.apache.jcs.utils=INFO
  
  
  
  1.11      +9 -6      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- cache.ccf	6 Jan 2005 01:17:55 -0000	1.10
  +++ cache.ccf	6 Jan 2005 04:44:28 -0000	1.11
  @@ -21,9 +21,9 @@
   ##############################################################
   ################## CACHE REGIONS AVAILABLE ###################
   # Regions preconfirgured for caching
  -jcs.region.testCache1=DC
  +jcs.region.testCache1=RC
   jcs.region.testCache1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
  -jcs.region.testCache1.cacheattributes.MaxObjects=10
  +jcs.region.testCache1.cacheattributes.MaxObjects=1000
   jcs.region.testCache1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
   jcs.region.testCache1.cacheattributes.UseMemoryShrinker=false
   jcs.region.testCache1.cacheattributes.MaxMemoryIdleTimeSeconds=5000
  @@ -31,8 +31,9 @@
   jcs.region.testCache1.cacheattributes.ShrinkerIntervalSeconds=30
   jcs.region.testCache1.elementattributes=org.apache.jcs.engine.ElementAttributes
   jcs.region.testCache1.elementattributes.IsEternal=false
  -jcs.region.testCache1.elementattributes.MaxLifeSeconds=6000
  +jcs.region.testCache1.elementattributes.MaxLifeSeconds=60000
   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
  @@ -112,15 +113,17 @@
   # 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=localhost
  -jcs.auxiliary.RC.attributes.RemotePort=1102
  +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.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.GetTimeoutMillis=0
   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.6       +4 -4      jakarta-turbine-jcs/src/test-conf/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-jcs/src/test-conf/log4j.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- log4j.properties	6 Jan 2005 01:21:04 -0000	1.5
  +++ log4j.properties	6 Jan 2005 04:44:28 -0000	1.6
  @@ -1,8 +1,8 @@
  -log4j.rootCategory=WARN, stdout, logfile
  +log4j.rootCategory=INFO, stdout, logfile
   
  -log4j.category.org.apache.jcs.=DEBUG, stdout, logfile
  -log4j.category.org.apache.jcs.auxiliary.remote=DEBUG, stdout, logfile
  -log4j.category.org.apache.jcs.utils.threadpool=DEBUG, stdout, logfile
  +log4j.category.org.apache.jcs.=INFO, stdout, logfile
  +log4j.category.org.apache.jcs.auxiliary.remote=INFO, stdout, logfile
  +log4j.category.org.apache.jcs.utils.threadpool=INFO, stdout, logfile
   
   log4j.appender.stdout=org.apache.log4j.ConsoleAppender
   log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  
  
  
  1.2       +651 -642  jakarta-turbine-jcs/tempbuild/jcs-1.1.3-dev.jar
  
  	<<Binary file>>
  
  
  1.12      +36 -2     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CompositeCacheManager.java	6 Jan 2005 01:18:27 -0000	1.11
  +++ CompositeCacheManager.java	6 Jan 2005 04:44:28 -0000	1.12
  @@ -1,6 +1,5 @@
   package org.apache.jcs.engine.control;
   
  -
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
    *
  @@ -21,6 +20,7 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.Serializable;
  +import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Iterator;
  @@ -37,6 +37,8 @@
   import org.apache.jcs.engine.behavior.ICacheType;
   import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
   import org.apache.jcs.engine.behavior.IElementAttributes;
  +import org.apache.jcs.engine.stats.CacheStats;
  +import org.apache.jcs.engine.stats.behavior.ICacheStats;
   import org.apache.jcs.utils.threadpool.ThreadPoolManager;
   
   /** Manages a composite cache. */
  @@ -202,7 +204,7 @@
           // set the props value and then configure the ThreadPoolManager
           ThreadPoolManager.setProps( props );
           ThreadPoolManager poolMgr =  ThreadPoolManager.getInstance();
  -      
  +
           // configure the cache
           CompositeCacheConfigurator configurator =
               new CompositeCacheConfigurator( this );
  @@ -440,5 +442,37 @@
       {
           return ( AuxiliaryCacheAttributes ) auxAttrs.get( name );
       }
  +
  +    /**
  +     * Gets stats for debugging.
  +     * @return String
  +     */
  +    public String getStats()
  +    {
  +      return getStatistics().toString();
  +    }
  +
  +    /**
  +     * This returns data gathered for all region and all the
  +     * auxiliaries they currently uses.
  +     *
  +     * @return
  +     */
  +    public ICacheStats[] getStatistics()
  +    {
  +      ArrayList cacheStats = new ArrayList();
  +      Enumeration allCaches = caches.elements();
  +      while ( allCaches.hasMoreElements() )
  +      {
  +          CompositeCache cache = ( CompositeCache ) allCaches.nextElement();
  +          if ( cache != null )
  +          {
  +            cacheStats.add( cache.getStatistics() );
  +          }
  +      }
  +      ICacheStats[] stats = (ICacheStats[])cacheStats.toArray( new CacheStats[0] );
  +      return stats;
  +  }
  +
   }
   
  
  
  
  1.18      +9 -10     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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CompositeCache.java	6 Jan 2005 01:18:27 -0000	1.17
  +++ CompositeCache.java	6 Jan 2005 04:44:28 -0000	1.18
  @@ -21,7 +21,6 @@
   import java.io.IOException;
   import java.io.Serializable;
   import java.util.ArrayList;
  -import java.util.Arrays;
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Set;
  @@ -998,38 +997,38 @@
        * @return String
        */
       public String getStats()
  -    {      
  +    {
         return getStatistics().toString();
       }
   
       /**
        * This returns data gathered for this region and all the
        * auxiliaries it currently uses.
  -     * 
  +     *
        * @return
        */
       public ICacheStats getStatistics()
       {
       	ICacheStats stats = new CacheStats();
       	stats.setRegionName( this.getCacheName() );
  -    	
  +
       	// store the composite cache stats first
       	IStatElement[] elems = new StatElement[2];
       	elems[0] = new StatElement();
       	elems[0].setName( "HitCountRam" );
       	elems[0].setData( "" + getHitCountRam() );
  -    	
  +
       	elems[1] = new StatElement();
       	elems[1].setName( "HitCountAux" );
       	elems[1].setData( "" + getHitCountAux() );
   
       	// store these local stats
       	stats.setStatElements( elems );
  -    	
  +
       	// memory + aux, memory is not considered an auxiliary internally
       	int total = auxCaches.length + 1;
       	IStats[] auxStats = new Stats[total];
  -    	    	
  +
       	auxStats[0] = getMemoryCache().getStatistics();
   
       	for ( int i = 0; i < auxCaches.length; i++ )
  @@ -1040,10 +1039,10 @@
   
       	// sore the auxiliary stats
       	stats.setAuxiliaryCacheStats( auxStats );
  -    	
  +
       	return stats;
     }
  -    
  +
   
       /**
        *  Gets the cacheName attribute of the Cache object
  
  
  

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