jakarta-jcs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asm...@apache.org
Subject svn commit: r421965 [2/2] - in /jakarta/jcs/trunk/src/java/org/apache/jcs: auxiliary/disk/jdbc/mysql/ engine/ engine/memory/ utils/access/ utils/config/ utils/net/ utils/props/ utils/serialization/ utils/servlet/ utils/struct/ utils/threadpool/ utils/t...
Date Fri, 14 Jul 2006 17:49:14 GMT
Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorker.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 package org.apache.jcs.utils.access;
 
 /*
- * Copyright 2002-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.
+ * Copyright 2002-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.Serializable;
@@ -25,7 +20,6 @@
 import org.apache.jcs.JCS;
 import org.apache.jcs.access.exception.CacheException;
 
-
 /**
  * Utility class to encapsulate doing a piece of work, and caching the results
  * in JCS. Simply construct this class with the region name for the Cache and
@@ -43,43 +37,49 @@
  * and all subsequent workers with the same region, group, and key will wait on
  * the first one and use his resulting work instead of doing the work
  * themselves.
- * 
+ * <p>
  * This is ideal when the work being done is a query to the database where the
  * results may take time to be retrieved.
+ * <p>
+ * For example:
  * 
- * For example: <br>
+ * <pre>
+ *      public static JCSWorker cachingWorker = new JCSWorker(&quot;example region&quot;);
+ *   		public Object getSomething(Serializable aKey){
+ *        JCSWorkerHelper helper = new AbstractJCSWorkerHelper(){
+ *          public Object doWork(){
+ *            // Do some (DB?) work here which results in a list 
+ *            // This only happens if the cache dosn't have a item in this region for aKey 
+ *            // Note this is especially useful with Hibernate, which will cache indiviual
+ *            // Objects, but not entire query result sets.
+ *            List results = query.list();
+ *            // Whatever we return here get's cached with aKey, and future calls to 
+ *            // getResult() on a CachedWorker with the same region and key will return that instead.
+ *            return results;
+ *        };
+ *        List result = worker.getResult(aKey, helper);
+ *      }
+ * </pre>
  * 
- * <code>
- *    public static JCSWorker cachingWorker = new JCSWorker("example region");<br>
- * 		public Object getSomething(Serializable aKey){<br>
- *      JCSWorkerHelper helper = new AbstractJCSWorkerHelper(){<br>
- *        public Object doWork(){<br>
- *          // Do some (DB?) work here which results in a list <br>
- *          // This only happens if the cache dosn't have a item in this region for aKey <br>
- *          // Note this is especially useful with Hibernate, which will cache indiviual <br>
- *          // Objects, but not entire query result sets. <br>
- *          List results = query.list(); <br>
- *          // Whatever we return here get's cached with aKey, and future calls to <br>
- *          // getResult() on a CachedWorker with the same region and key will return that instead. <br>
- *          return results; <br>
- *      };<br>
- *      List result = worker.getResult(aKey, helper);<br>
- *    }
- * </code>
+ * This is essentially the same as doing:
  * 
- * This is essentially the same as doing: <code>
- *  JCS jcs = JCS.getInstance("exampleregion");<br>
- *  List results = (List) jcs.get(aKey);<br>
- *  if(results != null){ //do the work here<br>
- *    results = query.list(); jcs.put(aKey, results);<br>
- *  }<br>
- * </code>
+ * <pre>
+ * JCS jcs = JCS.getInstance( &quot;exampleregion&quot; );
+ * List results = (List) jcs.get( aKey );
+ * if ( results != null )
+ * { 
+ *     //do the work here
+ *     results = query.list();
+ *     jcs.put( aKey, results );
+ * }
+ * </pre>
  * 
+ * <p>
  * But has the added benifit of the work-load sharing; under normal
  * circumstances if multiple threads all tried to do the same query at the same
  * time, the same query would happen multiple times on the database, and the
  * resulting object would get put into JCS multiple times.
- * 
+ * <p>
  * @author Travis Savo
  */
 public class JCSWorker
@@ -100,7 +100,6 @@
 
     /**
      * Constructor which takes a region for the JCS cache.
-     * 
      * @param aRegion
      *            The Region to use for the JCS cache.
      */
@@ -119,7 +118,6 @@
 
     /**
      * Getter for the region of the JCS Cache.
-     * 
      * @return The JCS region in which the result will be cached.
      */
     public String getRegion()
@@ -131,11 +129,8 @@
      * Gets the cached result for this region/key OR does the work and caches
      * the result, returning the result. If the result has not been cached yet,
      * this calls doWork() on the JCSWorkerHelper to do the work and cache the
-     * result.
-     * 
-     * This is also an opertunity to do any post processing of the result in
-     * your CachedWorker implementation.
-     * 
+     * result. This is also an opertunity to do any post processing of the
+     * result in your CachedWorker implementation.
      * @param aKey
      *            The key to get/put with on the Cache.
      * @param aWorker
@@ -157,11 +152,8 @@
      * Gets the cached result for this region/key OR does the work and caches
      * the result, returning the result. If the result has not been cached yet,
      * this calls doWork() on the JCSWorkerHelper to do the work and cache the
-     * result.
-     * 
-     * This is also an opertunity to do any post processing of the result in
-     * your CachedWorker implementation.
-     * 
+     * result. This is also an opertunity to do any post processing of the
+     * result in your CachedWorker implementation.
      * @param aKey
      *            The key to get/put with on the Cache.
      * @param aGroup
@@ -190,7 +182,6 @@
      * @param aKey
      * @param aGroup
      * @param aHelper
-     * 
      * @return Either the result of doing the work, or the cached result.
      * @throws Exception
      *             If something goes wrong while doing the work, throw an
@@ -200,18 +191,18 @@
         throws Exception
     {
         Object result = null;
-        //long start = 0;
-        //long dbTime = 0;
+        // long start = 0;
+        // long dbTime = 0;
         JCSWorkerHelper helper = null;
 
         synchronized ( map )
         {
-            //Check to see if we allready have a thread doing this work.
+            // Check to see if we allready have a thread doing this work.
             helper = (JCSWorkerHelper) map.get( getRegion() + aKey );
             if ( helper == null )
             {
-                //If not, add ourselves as the Worker so
-                //calls in another thread will use this worker's result
+                // If not, add ourselves as the Worker so
+                // calls in another thread will use this worker's result
                 map.put( getRegion() + aKey, aHelper );
             }
         }
@@ -234,7 +225,7 @@
                 }
             }
         }
-        //Do the work
+        // Do the work
         try
         {
             if ( logger.isDebugEnabled() )
@@ -243,7 +234,7 @@
             }
             result = null;
 
-            //Try to get the item from the cache
+            // Try to get the item from the cache
             if ( aGroup != null )
             {
                 result = cache.getFromGroup( aKey, aGroup );
@@ -252,7 +243,7 @@
             {
                 result = cache.get( aKey );
             }
-            //If the cache dosn't have it, do the work.
+            // If the cache dosn't have it, do the work.
             if ( result == null )
             {
                 result = aHelper.doWork();
@@ -260,7 +251,7 @@
                 {
                     logger.debug( "Work Done, caching: key:" + aKey + ", group:" + aGroup + ", result:" + result + "." );
                 }
-                //Stick the result of the work in the cache.
+                // Stick the result of the work in the cache.
                 if ( aGroup != null )
                 {
                     cache.putInGroup( aKey, aGroup, result );
@@ -270,7 +261,7 @@
                     cache.put( aKey, result );
                 }
             }
-            //return the result
+            // return the result
             return result;
         }
         finally
@@ -281,7 +272,7 @@
             }
             synchronized ( map )
             {
-                //Remove ourselves as the worker.
+                // Remove ourselves as the worker.
                 if ( helper == null )
                 {
                     map.remove( getRegion() + aKey );
@@ -289,7 +280,7 @@
                 synchronized ( this )
                 {
                     aHelper.setFinished( true );
-                    //Wake everyone waiting on us
+                    // Wake everyone waiting on us
                     notifyAll();
                 }
             }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorkerHelper.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorkerHelper.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorkerHelper.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/access/JCSWorkerHelper.java Fri Jul 14 10:49:13 2006
@@ -1,27 +1,24 @@
 package org.apache.jcs.utils.access;
 
 /*
- * Copyright 2002-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.
+ * Copyright 2002-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.
  */
 
 /**
  * Interface for doing a piece of work which is expected to be cached. This is
- * ment to be used in conjunction with JCSWorker. Implement doWork() to return
- * the work being done. isFinished() should return false until setFinished(true)
- * is called, after which time it should return true.
- * 
+ * ment to be used in conjunction with JCSWorker.
+ * <p>
+ * Implement doWork() to return the work being done. isFinished() should return
+ * false until setFinished(true) is called, after which time it should return
+ * true.
+ * <p>
  * @author tsavo
  */
 public interface JCSWorkerHelper
@@ -29,14 +26,14 @@
     /**
      * Tells us weather or not the work has been completed. This will be called
      * automatically by JCSWorker. You should not call it yourself.
-     * 
+     * <p>
      * @return True if the work has allready been done, otherwise false.
      */
     public boolean isFinished();
 
     /**
      * Sets weather or not the work has been done.
-     * 
+     * <p>
      * @param isFinished
      *            True if the work has allready been done, otherwise false.
      */
@@ -45,7 +42,7 @@
     /**
      * The method to implement to do the work that should be cached. JCSWorker
      * will call this itself! You should not call this directly.
-     * 
+     * <p>
      * @return The result of doing the work to be cached.
      * @throws Exception
      *             If anything goes wrong while doing the work, an Exception

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/config/IUtilConstants.java Fri Jul 14 10:49:13 2006
@@ -1,32 +1,28 @@
 package org.apache.jcs.utils.config;
 
 /*
- * 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.
+ * 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.InputStream;
 import java.io.IOException;
-
+import java.io.InputStream;
 import java.util.Properties;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
- * Description of the Interface
- *  
+ * This can hold some constants used by various utilities. We should probably
+ * just get rid of this.
+ * <p>
+ * It loads properties from jcsutil.properties on initialization.
  */
 public interface IUtilConstants
 {
@@ -38,7 +34,6 @@
 
     /**
      * Description of the Class
-     *  
      */
     final static class Config
     {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/net/HostNameUtil.java Fri Jul 14 10:49:13 2006
@@ -7,10 +7,9 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
- * Simple utility for getting hte local host name.
- * 
+ * Simple utility for getting the local host name.
+ * <p>
  * @author Aaron Smuts
- * 
  */
 public class HostNameUtil
 {
@@ -18,8 +17,7 @@
 
     /**
      * Gets the address for the local machine.
-     * 
-     * 
+     * <p>
      * @return InetAddress.getLocalHost().getHostAddress(), or unknown if there
      *         is an error.
      */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/props/PropertyLoader.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 package org.apache.jcs.utils.props;
 
 /*
- * 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.
+ * 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.InputStream;
@@ -22,20 +17,18 @@
 /**
  * I modified this class to work with .ccf files in particular. I also removed
  * the resource bundle functionality.
- * 
+ * <p>
  * A simple class for loading java.util.Properties backed by .ccf files deployed
  * as classpath resources. See individual methods for details.
  * <p>
  * The original source is from:
- * 
+ * <p>
  * @author (C) <a
  *         href="http://www.javaworld.com/columns/jw-qna-index.shtml">Vlad
  *         Roubtsov </a>, 2003
- * 
  */
 public abstract class PropertyLoader
 {
-
     private static final boolean THROW_ON_LOAD_FAILURE = true;
 
     private static final String SUFFIX = ".ccf";
@@ -48,25 +41,19 @@
      * use either "/" or "." for package segment separation with an optional
      * leading "/" and optional ".ccf" suffix.
      * <p>
-     * The suffix ".ccf" will be appended if it is not set.  This can also handle .properties files
-     * 
+     * The suffix ".ccf" will be appended if it is not set. This can also handle
+     * .properties files
+     * <p>
      * Thus, the following names refer to the same resource:
      * 
      * <pre>
-     *  
-     *   
-     *    
-     *     
-     *      some.pkg.Resource
-     *      some.pkg.Resource.ccf
-     *      some/pkg/Resource
-     *      some/pkg/Resource.ccf
-     *      /some/pkg/Resource
-     *      /some/pkg/Resource.ccf
-     *      
-     *     
-     *    
      *   
+     *       some.pkg.Resource
+     *       some.pkg.Resource.ccf
+     *       some/pkg/Resource
+     *       some/pkg/Resource.ccf
+     *       /some/pkg/Resource
+     *       /some/pkg/Resource.ccf
      * </pre>
      * 
      * @param name
@@ -74,7 +61,6 @@
      * @param loader
      *            classloader through which to load the resource [null is
      *            equivalent to the application loader]
-     * 
      * @return resource converted to java.util.properties [may be null if the
      *         resource was not found and THROW_ON_LOAD_FAILURE is false]
      * @throws IllegalArgumentException
@@ -163,7 +149,7 @@
      * that uses the current thread's context classloader. A better strategy
      * would be to use techniques shown in
      * http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load.html
-     * 
+     * <p>
      * @param name
      * @return Properties
      */
@@ -174,7 +160,6 @@
 
     /**
      * Can't use this one.
-     * 
      */
     private PropertyLoader()
     {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/SerializationConversionUtil.java Fri Jul 14 10:49:13 2006
@@ -12,19 +12,17 @@
 
 /**
  * This uses a supplied Serialer to convert to and from cache elements.
- * 
+ * <p>
  * @author Aaron Smuts
- * 
  */
 public class SerializationConversionUtil
 {
-
     private final static Log log = LogFactory.getLog( SerializationConversionUtil.class );
 
     /**
      * This returns a wrapper that has a serialized version of the value instead
      * of the value.
-     * 
+     * <p>
      * @param element
      * @param elementSerializer
      *            the serializer to be used.
@@ -77,7 +75,7 @@
     /**
      * This returns a wrapper that has a de-serialized version of the value
      * instead of the serialized value.
-     * 
+     * <p>
      * @param serialized
      * @param elementSerializer
      *            the serializer to be used.
@@ -126,5 +124,4 @@
 
         return deSerialized;
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/serialization/StandardSerializer.java Fri Jul 14 10:49:13 2006
@@ -12,10 +12,8 @@
 
 /**
  * Performs default serialization and de-serialization.
- * 
- *
+ * <p>
  * @author Aaron Smuts
- *
  */
 public class StandardSerializer
     implements IElementSerializer
@@ -23,7 +21,6 @@
 
     /**
      * Serializes an object using default serilaization.
-     * 
      */
     public byte[] serialize( Serializable obj )
         throws IOException
@@ -42,8 +39,8 @@
     }
 
     /**
-     * Uses default de-serialization to turn a byte array into an object.  All exceptions are converted into 
-     * IOExceptions.
+     * Uses default de-serialization to turn a byte array into an object. All
+     * exceptions are converted into IOExceptions.
      */
     public Object deSerialize( byte[] data )
         throws IOException, ClassNotFoundException
@@ -71,5 +68,4 @@
             ois.close();
         }
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/BasicHttpAuthenticator.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/BasicHttpAuthenticator.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/BasicHttpAuthenticator.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/servlet/BasicHttpAuthenticator.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 package org.apache.jcs.utils.servlet;
 
 /*
- * 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.
+ * 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;
@@ -21,7 +16,6 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jcs.utils.config.IUtilConstants;
@@ -30,7 +24,6 @@
 
 /**
  * Used to perform basic http authentication.
- *  
  */
 public class BasicHttpAuthenticator
 {
@@ -51,6 +44,7 @@
 
     /**
      * Authenticates the http <code>"Authorization"</code> header information.
+     * <p>
      * @param req
      * @param res
      * @return boolean
@@ -78,6 +72,7 @@
     /**
      * Returns true iff the given "Authorization" http request header contains
      * authorized user id and password.
+     * <p>
      * @param authHeader
      * @return
      * @throws IOException
@@ -112,9 +107,9 @@
 
     /**
      * Default implementation of checking the password.
+     * <p>
      * @param userid
      * @param password
-     * 
      * @return true iff the given user id and password is valid.
      */
     protected boolean checkPassword( String userid, String password )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedList.java Fri Jul 14 10:49:13 2006
@@ -4,11 +4,12 @@
 import org.apache.commons.logging.LogFactory;
 
 /**
- * This is a generic thread safe double linked list.
+ * This is a generic thread safe double linked list. It's very simple and all
+ * the operations are so quick that course grained synchronization is more than
+ * acceptible.
  */
 public class DoubleLinkedList
 {
-
     // record size to avoid having to iterate
     private int size = 0;
 
@@ -21,7 +22,6 @@
 
     /**
      * Default constructor.
-     *
      */
     public DoubleLinkedList()
     {
@@ -30,13 +30,12 @@
 
     /**
      * Adds a new node to the end of the link list.
-     * 
+     * <p>
      * @param me
      *            The feature to be added to the Last
      */
     public void addLast( DoubleLinkedListNode me )
     {
-
         if ( first == null )
         {
             // empty list.
@@ -53,13 +52,12 @@
 
     /**
      * Adds a new node to the start of the link list.
-     * 
+     * <p>
      * @param me
      *            The feature to be added to the First
      */
     public synchronized void addFirst( DoubleLinkedListNode me )
     {
-
         if ( last == null )
         {
             // empty list.
@@ -76,9 +74,9 @@
     }
 
     /**
-     * Removes the specified node from the link list.
-     * @return
-     *  
+     * Returns the last node from the link list, if there are any nodes.
+     * <p>
+     * @return The last node.
      */
     public DoubleLinkedListNode getLast()
     {
@@ -91,8 +89,8 @@
 
     /**
      * Removes the specified node from the link list.
+     * <p>
      * @return
-     *  
      */
     public DoubleLinkedListNode getFirst()
     {
@@ -105,13 +103,12 @@
 
     /**
      * Moves an existing node to the start of the link list.
-     * 
+     * <p>
      * @param ln
      *            Description of the Parameter
      */
     public synchronized void makeFirst( DoubleLinkedListNode ln )
     {
-
         if ( ln.prev == null )
         {
             // already the first node. or not a node
@@ -141,7 +138,6 @@
      */
     public synchronized void removeAll()
     {
-
         for ( DoubleLinkedListNode me = first; me != null; )
         {
             if ( me.prev != null )
@@ -158,10 +154,10 @@
 
     /**
      * Removes the specified node from the link list.
-     * 
+     * <p>
      * @param me
      *            Description of the Parameter
-     * @return
+     * @return true if an element was removed.
      */
     public synchronized boolean remove( DoubleLinkedListNode me )
     {
@@ -213,8 +209,8 @@
 
     /**
      * Removes the specified node from the link list.
-     * @return
-     *  
+     * <p>
+     * @return The last node if there was one to remove.
      */
     public DoubleLinkedListNode removeLast()
     {
@@ -232,7 +228,7 @@
 
     /**
      * Returns the size of the list.
-     * 
+     * <p>
      * @return int
      */
     public int size()
@@ -240,7 +236,7 @@
         return size;
     }
 
-    /////////////////////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////////////////////
     /**
      * Dump the cache entries from first to list for debugging.
      */

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/DoubleLinkedListNode.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 package org.apache.jcs.utils.struct;
 
 /*
- * 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.
+ * 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.Serializable;
@@ -22,6 +17,9 @@
  * This serves as a placeholder in a double linked list. You can extend this to
  * add functionality. This allows you to remove in constant time from a linked
  * list.
+ * <p>
+ * It simply holds the payload and a reference to the items before and after it
+ * in the list.
  */
 public class DoubleLinkedListNode
     implements Serializable
@@ -37,7 +35,6 @@
     public DoubleLinkedListNode next;
 
     /**
-     * 
      * @param payloadP
      */
     public DoubleLinkedListNode( Object payloadP )
@@ -52,5 +49,4 @@
     {
         return payload;
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUElementDescriptor.java Fri Jul 14 10:49:13 2006
@@ -1,14 +1,14 @@
 package org.apache.jcs.utils.struct;
 
-
 /**
+ * This is a node in the double linked list. It is stored as the value in the
+ * underlying map used by the LRUMap class.
+ * <p>
  * @author aaronsm
- * 
  */
 public class LRUElementDescriptor
     extends DoubleLinkedListNode
 {
-
     private static final long serialVersionUID = 8249555756363020156L;
 
     /**

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMap.java Fri Jul 14 10:49:13 2006
@@ -29,22 +29,18 @@
  * should be thread safe. It uses a hashtable and our own double linked list.
  * <p>
  * Locking is done on the instance.
- * 
+ * <p>
  * @author aaronsm
- * 
  */
 public class LRUMap
     implements Map
 {
-
     private final static Log log = LogFactory.getLog( LRUMap.class );
 
     // double linked list for lru
     private DoubleLinkedList list;
 
-    /**
-     * Map where items are stored by key
-     */
+    /** Map where items are stored by key. */
     protected Map map;
 
     int hitCnt = 0;
@@ -62,7 +58,7 @@
     /**
      * This creates an unbounded version. Setting the max objects will result in
      * spooling on subsequent puts.
-     * 
+     * <p>
      * @param maxObjects
      */
     public LRUMap()
@@ -77,7 +73,7 @@
 
     /**
      * This sets the size limit.
-     * 
+     * <p>
      * @param maxObjects
      */
     public LRUMap( int maxObjects )
@@ -86,9 +82,9 @@
         this.maxObjects = maxObjects;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * This simply returned the number of elements in the map.
+     * <p>
      * @see java.util.Map#size()
      */
     public int size()
@@ -96,9 +92,9 @@
         return map.size();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * This removes all the items. It clears the map and the double linked list.
+     * <p>
      * @see java.util.Map#clear()
      */
     public void clear()
@@ -107,9 +103,9 @@
         list.removeAll();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * Returns true if the map is empty.
+     * <p>
      * @see java.util.Map#isEmpty()
      */
     public boolean isEmpty()
@@ -117,9 +113,9 @@
         return map.size() == 0;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * Returns true if the map contains an element for the supplied key.
+     * <p>
      * @see java.util.Map#containsKey(java.lang.Object)
      */
     public boolean containsKey( Object key )
@@ -127,9 +123,10 @@
         return map.containsKey( key );
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * This is an expensive operation that determines if the object supplied is
+     * mapped to any key.
+     * <p>
      * @see java.util.Map#containsValue(java.lang.Object)
      */
     public boolean containsValue( Object value )
@@ -139,7 +136,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#values()
      */
     public Collection values()
@@ -149,7 +145,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#putAll(java.util.Map)
      */
     public void putAll( Map source )
@@ -166,9 +161,12 @@
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /**
+     * This returns a set of entries. Our LRUMapEntry is used since the value
+     * stored in the underlying map is a node in the double linked list. We
+     * wouldn't want to return this to the client, so we construct a new entry
+     * with the payload of the node.
+     * <p>
      * @see java.util.Map#entrySet()
      */
     public Set entrySet()
@@ -194,7 +192,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#keySet()
      */
     public Set keySet()
@@ -205,7 +202,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#get(java.lang.Object)
      */
     public Object get( Object key )
@@ -242,6 +238,11 @@
     }
 
     /**
+     * This gets an element out of the map without adjusting it's posisiton in
+     * the LRU. In other words, this does not count as being used. If the
+     * element is the last item in the list, it will still be the last itme in
+     * the list.
+     * <p>
      * @param key
      * @return Object
      */
@@ -269,7 +270,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#remove(java.lang.Object)
      */
     public Object remove( Object key )
@@ -294,7 +294,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map#put(java.lang.Object, java.lang.Object)
      */
     public Object put( Object key, Object value )
@@ -396,7 +395,7 @@
 
     /**
      * Adds a new node to the start of the link list.
-     * 
+     * <p>
      * @param key
      * @param val
      *            The feature to be added to the First
@@ -411,7 +410,7 @@
 
     /**
      * Returns the size of the list.
-     * 
+     * <p>
      * @return int
      */
     private int dumpCacheSize()
@@ -454,7 +453,6 @@
     /**
      * Checks to see if all the items that should be in the cache are. Checks
      * consistency between List and map.
-     * 
      */
     protected void verifyCache()
     {
@@ -543,7 +541,7 @@
 
     /**
      * Logs an error is an element that should be in the cache is not.
-     * 
+     * <p>
      * @param key
      */
     protected void verifyCache( Object key )
@@ -576,7 +574,6 @@
      * information.
      * <p>
      * Children can implement this method for special behavior.
-     * 
      * @param key
      * @param value
      */
@@ -592,7 +589,7 @@
     /**
      * The chunk size is the number of items to remove when the max is reached.
      * By default it is 1.
-     * 
+     * <p>
      * @param chunkSize
      *            The chunkSize to set.
      */
@@ -610,7 +607,6 @@
     }
 
     /**
-     * 
      * @return IStats
      */
     public IStats getStatistics()
@@ -653,5 +649,4 @@
 
         return stats;
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/LRUMapEntry.java Fri Jul 14 10:49:13 2006
@@ -5,9 +5,8 @@
 
 /**
  * Entry for the LRUMap.
- * 
+ * <p>
  * @author Aaron Smuts
- * 
  */
 public class LRUMapEntry
     implements Entry, Serializable
@@ -31,7 +30,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map$Entry#getKey()
      */
     public Object getKey()
@@ -41,7 +39,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map$Entry#getValue()
      */
     public Object getValue()
@@ -51,7 +48,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see java.util.Map$Entry#setValue(java.lang.Object)
      */
     public Object setValue( Object valueArg )
@@ -60,5 +56,4 @@
         this.value = valueArg;
         return old;
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/struct/SortedPreferentialArray.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 package org.apache.jcs.utils.struct;
 
 /*
- * 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.
+ * 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 org.apache.commons.logging.Log;
@@ -22,14 +17,12 @@
 /**
  * This maintains a sorted array with a preferential replacement policy when
  * full.
- * 
+ * <p>
  * Insertion time is n, search is log(n)
- * 
- * 
+ * <p>
  * Clients must manage thread safety on previous version. I synchronized the
  * public methods to add easy thread safety. I synchronized all public methods
  * that make modifications.
- * 
  */
 public class SortedPreferentialArray
 {
@@ -48,7 +41,7 @@
 
     /**
      * Consruct the array with the maximum size.
-     * 
+     * <p>
      * @param maxSize
      *            int
      */
@@ -62,7 +55,7 @@
      * If the array is full this will remove the smallest if preferLarge==true
      * and if obj is bigger, or the largest if preferLarge=false and obj is
      * smaller than the largest.
-     * 
+     * <p>
      * @param obj
      *            Object
      */
@@ -113,7 +106,7 @@
 
     /**
      * Returns the largest without removing it from the array.
-     * 
+     * <p>
      * @return Comparable
      */
     public synchronized Comparable getLargest()
@@ -123,7 +116,7 @@
 
     /**
      * Returns the smallest element without removing it from the array.
-     * 
+     * <p>
      * @return Comparable
      */
     public synchronized Comparable getSmallest()
@@ -134,7 +127,7 @@
     /**
      * Insert looks for the nearest largest. It then determines which way to
      * shuffle depending on the preference.
-     * 
+     * <p>
      * @param obj
      *            Comparable
      */
@@ -251,12 +244,11 @@
                 log.debug( this.dumpArray() );
             }
         }
-
-    } // end insert
+    }
 
     /**
      * Determines whether the preference is for large or small.
-     * 
+     * <p>
      * @param pref
      *            boolean
      */
@@ -267,7 +259,7 @@
 
     /**
      * Returns and removes the nearer larger or equal object from the aray.
-     * 
+     * <p>
      * @param obj
      *            Comparable
      * @return Comparable, null if arg is null or none was found.
@@ -312,7 +304,7 @@
 
     /**
      * Returns the current size of the array.
-     * 
+     * <p>
      * @return int
      */
     public int size()
@@ -323,7 +315,7 @@
     /**
      * This determines the position in the array that is occupied by an object
      * that is larger or equal to the argument. If none exists, -1 is returned.
-     * 
+     * <p>
      * @param obj
      *            Object
      * @return Object
@@ -358,24 +350,24 @@
      * This method determines the position where an insert should take place for
      * a given object. With some additional checking, this can also be used to
      * find an object matching or greater than the argument.
-     * 
+     * <p>
      * If the array is not full and the current object is larger than all the
      * rest the first open slot at the end will be returned.
-     * 
+     * <p>
      * If the object is larger than the largest and it is full, it will return
      * the last position.
-     * 
+     * <p>
      * If the array is empty, the first spot is returned.
-     * 
+     * <p>
      * If the object is smaller than all the rests, the first position is
      * returned. The caller must decide what to do given the preference.
-     * 
+     * <p>
      * Returns the position of the object nearest to or equal to the larger
      * object.
-     * 
+     * <p>
      * If you want to find the takePosition, you have to calculate it.
      * findNearestOccupiedLargerOrEqualPosition will calculate this for you
-     * 
+     * <p>
      * @param obj
      *            Comparable
      * @return int
@@ -501,6 +493,8 @@
                     greaterPos = curPos;
                     // set the current position to
                     // set the previous position to the current position
+                    // We could have an integer overflow, but this array could
+                    // never get that large.
                     int newPos = Math.min( curPos, ( curPos + prevPos ) / 2 );
                     prevPos = curPos;
                     curPos = newPos;
@@ -556,7 +550,7 @@
     /**
      * Removes the item from the array at the specified position. The remaining
      * items to the right are shifted left.
-     * 
+     * <p>
      * @param position
      *            int
      * @throw IndexOutOfBoundsException if position is out of range.
@@ -589,7 +583,7 @@
 
     /**
      * Debugging method to return a human readable display of array data.
-     * 
+     * <p>
      * @return
      */
     protected String dumpArray()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/PoolConfiguration.java Fri Jul 14 10:49:13 2006
@@ -3,31 +3,24 @@
 import org.apache.jcs.utils.threadpool.behavior.IPoolConfiguration;
 
 /*
- * 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.
+ * 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.
- * 
+ * <p>
  * @author Aaron Smuts
- *  
  */
 public class PoolConfiguration
     implements Cloneable, IPoolConfiguration
 {
-
     private boolean useBoundary = true;
 
     private int boundarySize = 2000;
@@ -41,7 +34,7 @@
 
     private int keepAliveTime = 1000 * 60 * 5;
 
-    //should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST,
+    // should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST,
     private String whenBlockedPolicy = POLICY_RUN;
 
     private int startUpSize = 4;
@@ -65,7 +58,6 @@
 
     /**
      * Default
-     *  
      */
     public PoolConfiguration()
     {
@@ -73,7 +65,8 @@
     }
 
     /**
-     * 
+     * Construct a completely configured instance.
+     * <p>
      * @param useBoundary
      * @param boundarySize
      * @param maximumPoolSize
@@ -85,7 +78,7 @@
     public PoolConfiguration( boolean useBoundary, int boundarySize, int maximumPoolSize, int minimumPoolSize,
                              int keepAliveTime, String whenBlockedPolicy, int startUpSize )
     {
-        setUseBoundary( useBoundary ) ;
+        setUseBoundary( useBoundary );
         setBoundarySize( boundarySize );
         setMaximumPoolSize( maximumPoolSize );
         setMinimumPoolSize( minimumPoolSize );
@@ -170,6 +163,8 @@
     {
         if ( whenBlockedPolicy != null )
         {
+            whenBlockedPolicy = whenBlockedPolicy.trim();
+
             if ( whenBlockedPolicy.equalsIgnoreCase( POLICY_ABORT ) )
             {
                 this.whenBlockedPolicy = POLICY_ABORT;
@@ -201,7 +196,6 @@
             // the value is null, dfault to RUN
             this.whenBlockedPolicy = POLICY_RUN;
         }
-
     }
 
     /**
@@ -236,18 +230,19 @@
     public String toString()
     {
         StringBuffer buf = new StringBuffer();
-        buf.append( "useBoundary = [" + isUseBoundary() + "]" );
-        buf.append( "boundarySize = [" + boundarySize + "]" );
-        buf.append( "maximumPoolSize = [" + maximumPoolSize + "]" );
-        buf.append( "minimumPoolSize = [" + minimumPoolSize + "]" );
-        buf.append( "keepAliveTime = [" + keepAliveTime + "]" );
-        buf.append( "whenBlockedPolicy = [" + getWhenBlockedPolicy() + "]" );
+        buf.append( "useBoundary = [" + isUseBoundary() + "] " );
+        buf.append( "boundarySize = [" + boundarySize + "] " );
+        buf.append( "maximumPoolSize = [" + maximumPoolSize + "] " );
+        buf.append( "minimumPoolSize = [" + minimumPoolSize + "] " );
+        buf.append( "keepAliveTime = [" + keepAliveTime + "] " );
+        buf.append( "whenBlockedPolicy = [" + getWhenBlockedPolicy() + "] " );
         buf.append( "startUpSize = [" + startUpSize + "]" );
         return buf.toString();
     }
 
     /**
      * Copies the instance variables to another instance.
+     * <p>
      * @return PoolConfiguration
      */
     public Object clone()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPool.java Fri Jul 14 10:49:13 2006
@@ -6,20 +6,18 @@
 /**
  * This is simply a wrapper around the Pooled Excutor that allows clients to
  * access the queue.
- * 
+ * <p>
  * @author aaronsm
- *  
  */
 public class ThreadPool
 {
-
     private PooledExecutor pool = null;
 
     private Channel queue = null;
 
     /**
      * Create the wrapper.
-     * 
+     * <p>
      * @param pool
      * @param queue
      */
@@ -31,7 +29,7 @@
 
     /**
      * This is intended to give the client access to the PooledExecutor itself.
-     * 
+     * <p>
      * @return Returns the pool.
      */
     public PooledExecutor getPool()
@@ -48,7 +46,8 @@
     }
 
     /**
-     * 
+     * Delegates execution to the pooled executor.
+     * <p>
      * @param run
      * @throws InterruptedException
      */
@@ -57,5 +56,4 @@
     {
         pool.execute( run );
     }
-
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/ThreadPoolManager.java Fri Jul 14 10:49:13 2006
@@ -1,19 +1,14 @@
 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.
+ * 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.util.ArrayList;
@@ -36,19 +31,19 @@
  * 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
- * 
+ * <p>
  * 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
+ * <p>
+ * This manager forces 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.
- * 
+ * <p>
  * 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.
- * 
+ * <p>
+ * If set, the Properties object will take precedence.
+ * <p>
  * If a value is not set for a particular pool, the hard coded defaults will be
  * used.
  * 
@@ -70,13 +65,11 @@
  * 
  * You can configure default settings by specifying a default pool in the
  * properties, ie "cache.ccf"
- * 
+ * <p>
  * @author Aaron Smuts
- * 
  */
 public class ThreadPoolManager
 {
-
     private static final Log log = LogFactory.getLog( ThreadPoolManager.class );
 
     // DEFAULT SETTINGS, these are not final since they can be set
@@ -118,7 +111,6 @@
 
     /**
      * No instances please. This is a singleton.
-     * 
      */
     private ThreadPoolManager()
     {
@@ -127,7 +119,7 @@
 
     /**
      * Creates a pool based on the configuration info.
-     * 
+     * <p>
      * @param config
      * @return A ThreadPoll wrapper
      */
@@ -188,8 +180,8 @@
      * 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
+     * <p>
+     * @return The single instance of the ThreadPoolManager
      */
     public static synchronized ThreadPoolManager getInstance()
     {
@@ -204,12 +196,11 @@
      * 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.
-     * 
+     * <p>
      * Pools are lazily created.
-     * 
-     * 
+     * <p>
      * @param name
-     * @return
+     * @return The thread pool configured for the name.
      */
     public ThreadPool getPool( String name )
     {
@@ -243,8 +234,8 @@
     }
 
     /**
-     * returns the names of all configured pools.
-     * 
+     * Returns the names of all configured pools.
+     * <p>
      * @return ArrayList of string names
      */
     public ArrayList getPoolNames()
@@ -264,7 +255,7 @@
 
     /**
      * Setting this post initialization will have no effect.
-     * 
+     * <p>
      * @param propsFileName
      *            The propsFileName to set.
      */
@@ -274,7 +265,10 @@
     }
 
     /**
-     * 
+     * Returns the name of the properties file that we used to initialize the
+     * pools. If the value was set post-initialization, then it may not be the
+     * file used.
+     * <p>
      * @return Returns the propsFileName.
      */
     public static String getPropsFileName()
@@ -285,7 +279,7 @@
     /**
      * This will be used if it is not null on initialzation. Setting this post
      * initialization will have no effect.
-     * 
+     * <p>
      * @param props
      *            The props to set.
      */
@@ -305,7 +299,6 @@
     /**
      * Intialize the ThreadPoolManager and create all the pools defined in the
      * configuration.
-     * 
      */
     protected void configure()
     {
@@ -344,19 +337,16 @@
                                                whenBlockedPolicy_DEFAULT, startUpSize_DEFAULT );
 
         defaultConfig = loadConfig( DEFAULT_PROP_NAME_ROOT );
-
     }
 
     /**
-     * Configures the default PoolConfiguration settings
-     * 
+     * Configures the default PoolConfiguration settings.
+     * <p>
      * @param root
      * @return PoolConfiguration
-     * 
      */
     protected PoolConfiguration loadConfig( String root )
     {
-
         PoolConfiguration config = (PoolConfiguration) defaultConfig.clone();
 
         if ( props.containsKey( root + ".useBoundary" ) )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/behavior/IPoolConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/behavior/IPoolConfiguration.java?rev=421965&r1=421964&r2=421965&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/behavior/IPoolConfiguration.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/utils/threadpool/behavior/IPoolConfiguration.java Fri Jul 14 10:49:13 2006
@@ -1,8 +1,9 @@
 package org.apache.jcs.utils.threadpool.behavior;
 
 /**
+ * This provides values to use for the when-blocked-policy.
+ * <p>
  * @author aaronsm
- *  
  */
 public interface IPoolConfiguration
 {
@@ -78,9 +79,9 @@
 
     /**
      * should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST.
-     * 
-     * If an incorrect value is returned, run will be used.
-     * 
+     * <p>
+     * If an incorrect value is returned, RUN will be used.
+     * <p>
      * @param whenBlockedPolicy
      *            The whenBlockedPolicy to set.
      */



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


Mime
View raw message