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 tv...@apache.org on 2007/05/10 18:04:27 UTC

svn commit: r536904 [16/38] - in /jakarta/jcs/trunk: ./ auxiliary-builds/javagroups/ auxiliary-builds/javagroups/src/java/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/javagroups/src/test/org/apache/jcs/auxiliary/javagroups/ auxiliary-builds/jd...

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLDiskCacheManager.java Thu May 10 09:03:42 2007
@@ -1,249 +1,257 @@
-package org.apache.jcs.auxiliary.disk.jdbc.mysql;
-
-/*
- * 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.Date;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
-import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheManagerAbstractTemplate;
-import org.apache.jcs.auxiliary.disk.jdbc.TableState;
-import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleFormatException;
-import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleParser;
-
-/**
- * This manages instances of the MySQL jdbc disk cache. It maintains one for
- * each region. One for all regions would work, but this gives us more detailed
- * stats by region.
- * <p>
- * Although the generic JDBC Disk Cache Manager can be used for MySQL, the MySQL
- * JDBC Disk Cache has additional features, such as table optimization that are
- * particular to MySQL.
- */
-public class MySQLDiskCacheManager
-    extends JDBCDiskCacheManagerAbstractTemplate
-{
-    private static final long serialVersionUID = -8258856770927857896L;
-
-    private static final Log log = LogFactory.getLog( MySQLDiskCacheManager.class );
-
-    private static MySQLDiskCacheManager instance;
-
-    private MySQLDiskCacheAttributes defaultJDBCDiskCacheAttributes;
-
-    // ms in a day
-    private static final int DAILY_INTERVAL = 60 * 60 * 24 * 1000;
-
-    // for schedule optimizations
-    private Timer daemon = null;
-
-    /**
-     * Constructor for the HSQLCacheManager object
-     * <p>
-     * @param cattr
-     */
-    private MySQLDiskCacheManager( MySQLDiskCacheAttributes cattr )
-    {
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Creating MySQLDiskCacheManager with " + cattr );
-        }
-        defaultJDBCDiskCacheAttributes = cattr;
-    }
-
-    /**
-     * Gets the defaultCattr attribute of the HSQLCacheManager object
-     * <p>
-     * @return The defaultCattr value
-     */
-    public MySQLDiskCacheAttributes getDefaultJDBCDiskCacheAttributes()
-    {
-        return defaultJDBCDiskCacheAttributes;
-    }
-
-    /**
-     * Gets the instance attribute of the HSQLCacheManager class
-     * <p>
-     * @param cattr
-     * @return The instance value
-     */
-    public static MySQLDiskCacheManager getInstance( MySQLDiskCacheAttributes cattr )
-    {
-        synchronized ( MySQLDiskCacheManager.class )
-        {
-            if ( instance == null )
-            {
-                instance = new MySQLDiskCacheManager( cattr );
-            }
-        }
-        clients++;
-        return instance;
-    }
-
-    /**
-     * Gets the cache attribute of the HSQLCacheManager object
-     * <p>
-     * @param cacheName
-     * @return The cache value
-     */
-    public AuxiliaryCache getCache( String cacheName )
-    {
-        MySQLDiskCacheAttributes cattr = (MySQLDiskCacheAttributes) defaultJDBCDiskCacheAttributes.copy();
-        cattr.setCacheName( cacheName );
-        return getCache( cattr );
-    }
-
-    /**
-     * Creates a JDBCDiskCache using the supplied attributes.
-     * <p>
-     * @param cattr
-     * @return
-     */
-    protected AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
-    {
-        AuxiliaryCache raf = new MySQLDiskCache( (MySQLDiskCacheAttributes) cattr, tableState );
-        
-        scheduleOptimizations( (MySQLDiskCacheAttributes) cattr, tableState );
-        
-        return raf;
-    }
-
-    /**
-     * For each time in the optimization schedule, this calls schedule
-     * Optimizaiton.
-     * <p>
-     * @param attributes
-     * @param tableState 
-     */
-    protected void scheduleOptimizations( MySQLDiskCacheAttributes attributes, TableState tableState )
-    {
-        if ( attributes != null )
-        {
-            if ( attributes.getOptimizationSchedule() != null )
-            {
-                if ( log.isInfoEnabled() )
-                {
-                    log.info( "Will try to configure optimization for table [" + attributes.getTableName()
-                        + "] on schdule [" + attributes.getOptimizationSchedule() + "]" );
-                }
-
-                MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState );
-
-                // loop through the dates.
-                try
-                {
-                    Date[] dates = ScheduleParser.createDatesForSchedule( attributes.getOptimizationSchedule() );
-                    if ( dates != null )
-                    {
-                        for ( int i = 0; i < dates.length; i++ )
-                        {
-                            this.scheduleOptimization( dates[i], optimizer );
-                        }
-                    }
-                }
-                catch ( ScheduleFormatException e )
-                {
-                    log.warn( "Problem creating optimization schedule for table [" + attributes.getTableName() + "]" );
-                }
-            }
-            else
-            {
-                if ( log.isInfoEnabled() )
-                {
-                    log.info( "Optimization is not configured for table [" + attributes.getTableName() + "]" );
-                }
-            }
-        }
-    }
-
-    /**
-     * This takes in a single time and schedules the optimizer to be called at
-     * that time every day.
-     * <p>
-     * @param startTime --
-     *            HH:MM:SS format
-     * @param optimizer
-     */
-    protected void scheduleOptimization( Date startTime, MySQLTableOptimizer optimizer )
-    {
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "startTime [" + startTime + "] for optimizer " + optimizer );
-        }
-
-        // create clock daemon if necessary
-        if ( daemon == null )
-        {
-            // true for daemon status
-            daemon = new Timer( true );
-        }
-
-        // get the runnable from the factory
-        TimerTask runnable = new OptimizerTask( optimizer );
-
-        // have the daemon execut our runnable
-        // false to not execute immediately.
-        daemon.scheduleAtFixedRate( runnable, startTime, DAILY_INTERVAL );
-        
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "Scheduled optimization to begin at [" + startTime + "]" );
-        }
-    }
-
-    /**
-     * This calls the optimizers' optimize table method. This is used by the
-     * timer.
-     * <p>
-     * @author Aaron Smuts
-     */
-    private class OptimizerTask
-        extends TimerTask
-    {
-        private MySQLTableOptimizer optimizer = null;
-
-        /**
-         * Get a handle on the optimizer.
-         * <p>
-         * @param optimizer
-         */
-        public OptimizerTask( MySQLTableOptimizer optimizer )
-        {
-            this.optimizer = optimizer;
-        }
-
-        /**
-         * This calls optimize on the optimizer.
-         * <p>
-         * @see java.lang.Runnable#run()
-         */
-        public void run()
-        {
-            if ( optimizer != null )
-            {
-                boolean success = optimizer.optimizeTable();
-                if ( log.isInfoEnabled() )
-                {
-                    log.info( "Optimization success status [" + success + "]" );
-                }
-            }
-            else
-            {
-                log.warn( "OptimizerRunner: The optimizer is null.  Could not optimize table." );
-            }
-        }
-    }
-}
+package org.apache.jcs.auxiliary.disk.jdbc.mysql;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
+import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheManagerAbstractTemplate;
+import org.apache.jcs.auxiliary.disk.jdbc.TableState;
+import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleFormatException;
+import org.apache.jcs.auxiliary.disk.jdbc.mysql.util.ScheduleParser;
+
+/**
+ * This manages instances of the MySQL jdbc disk cache. It maintains one for
+ * each region. One for all regions would work, but this gives us more detailed
+ * stats by region.
+ * <p>
+ * Although the generic JDBC Disk Cache Manager can be used for MySQL, the MySQL
+ * JDBC Disk Cache has additional features, such as table optimization that are
+ * particular to MySQL.
+ */
+public class MySQLDiskCacheManager
+    extends JDBCDiskCacheManagerAbstractTemplate
+{
+    private static final long serialVersionUID = -8258856770927857896L;
+
+    private static final Log log = LogFactory.getLog( MySQLDiskCacheManager.class );
+
+    private static MySQLDiskCacheManager instance;
+
+    private MySQLDiskCacheAttributes defaultJDBCDiskCacheAttributes;
+
+    // ms in a day
+    private static final int DAILY_INTERVAL = 60 * 60 * 24 * 1000;
+
+    // for schedule optimizations
+    private Timer daemon = null;
+
+    /**
+     * Constructor for the HSQLCacheManager object
+     * <p>
+     * @param cattr
+     */
+    private MySQLDiskCacheManager( MySQLDiskCacheAttributes cattr )
+    {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Creating MySQLDiskCacheManager with " + cattr );
+        }
+        defaultJDBCDiskCacheAttributes = cattr;
+    }
+
+    /**
+     * Gets the defaultCattr attribute of the HSQLCacheManager object
+     * <p>
+     * @return The defaultCattr value
+     */
+    public MySQLDiskCacheAttributes getDefaultJDBCDiskCacheAttributes()
+    {
+        return defaultJDBCDiskCacheAttributes;
+    }
+
+    /**
+     * Gets the instance attribute of the HSQLCacheManager class
+     * <p>
+     * @param cattr
+     * @return The instance value
+     */
+    public static MySQLDiskCacheManager getInstance( MySQLDiskCacheAttributes cattr )
+    {
+        synchronized ( MySQLDiskCacheManager.class )
+        {
+            if ( instance == null )
+            {
+                instance = new MySQLDiskCacheManager( cattr );
+            }
+        }
+        clients++;
+        return instance;
+    }
+
+    /**
+     * Gets the cache attribute of the HSQLCacheManager object
+     * <p>
+     * @param cacheName
+     * @return The cache value
+     */
+    public AuxiliaryCache getCache( String cacheName )
+    {
+        MySQLDiskCacheAttributes cattr = (MySQLDiskCacheAttributes) defaultJDBCDiskCacheAttributes.copy();
+        cattr.setCacheName( cacheName );
+        return getCache( cattr );
+    }
+
+    /**
+     * Creates a JDBCDiskCache using the supplied attributes.
+     * <p>
+     * @param cattr
+     * @return
+     */
+    protected AuxiliaryCache createJDBCDiskCache( JDBCDiskCacheAttributes cattr, TableState tableState )
+    {
+        AuxiliaryCache raf = new MySQLDiskCache( (MySQLDiskCacheAttributes) cattr, tableState );
+
+        scheduleOptimizations( (MySQLDiskCacheAttributes) cattr, tableState );
+
+        return raf;
+    }
+
+    /**
+     * For each time in the optimization schedule, this calls schedule
+     * Optimizaiton.
+     * <p>
+     * @param attributes
+     * @param tableState
+     */
+    protected void scheduleOptimizations( MySQLDiskCacheAttributes attributes, TableState tableState )
+    {
+        if ( attributes != null )
+        {
+            if ( attributes.getOptimizationSchedule() != null )
+            {
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Will try to configure optimization for table [" + attributes.getTableName()
+                        + "] on schdule [" + attributes.getOptimizationSchedule() + "]" );
+                }
+
+                MySQLTableOptimizer optimizer = new MySQLTableOptimizer( attributes, tableState );
+
+                // loop through the dates.
+                try
+                {
+                    Date[] dates = ScheduleParser.createDatesForSchedule( attributes.getOptimizationSchedule() );
+                    if ( dates != null )
+                    {
+                        for ( int i = 0; i < dates.length; i++ )
+                        {
+                            this.scheduleOptimization( dates[i], optimizer );
+                        }
+                    }
+                }
+                catch ( ScheduleFormatException e )
+                {
+                    log.warn( "Problem creating optimization schedule for table [" + attributes.getTableName() + "]" );
+                }
+            }
+            else
+            {
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Optimization is not configured for table [" + attributes.getTableName() + "]" );
+                }
+            }
+        }
+    }
+
+    /**
+     * This takes in a single time and schedules the optimizer to be called at
+     * that time every day.
+     * <p>
+     * @param startTime --
+     *            HH:MM:SS format
+     * @param optimizer
+     */
+    protected void scheduleOptimization( Date startTime, MySQLTableOptimizer optimizer )
+    {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "startTime [" + startTime + "] for optimizer " + optimizer );
+        }
+
+        // create clock daemon if necessary
+        if ( daemon == null )
+        {
+            // true for daemon status
+            daemon = new Timer( true );
+        }
+
+        // get the runnable from the factory
+        TimerTask runnable = new OptimizerTask( optimizer );
+
+        // have the daemon execut our runnable
+        // false to not execute immediately.
+        daemon.scheduleAtFixedRate( runnable, startTime, DAILY_INTERVAL );
+
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Scheduled optimization to begin at [" + startTime + "]" );
+        }
+    }
+
+    /**
+     * This calls the optimizers' optimize table method. This is used by the
+     * timer.
+     * <p>
+     * @author Aaron Smuts
+     */
+    private class OptimizerTask
+        extends TimerTask
+    {
+        private MySQLTableOptimizer optimizer = null;
+
+        /**
+         * Get a handle on the optimizer.
+         * <p>
+         * @param optimizer
+         */
+        public OptimizerTask( MySQLTableOptimizer optimizer )
+        {
+            this.optimizer = optimizer;
+        }
+
+        /**
+         * This calls optimize on the optimizer.
+         * <p>
+         * @see java.lang.Runnable#run()
+         */
+        public void run()
+        {
+            if ( optimizer != null )
+            {
+                boolean success = optimizer.optimizeTable();
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Optimization success status [" + success + "]" );
+                }
+            }
+            else
+            {
+                log.warn( "OptimizerRunner: The optimizer is null.  Could not optimize table." );
+            }
+        }
+    }
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/MySQLTableOptimizer.java Thu May 10 09:03:42 2007
@@ -1,336 +1,355 @@
-package org.apache.jcs.auxiliary.disk.jdbc.mysql;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
-import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCachePoolAccess;
-import org.apache.jcs.auxiliary.disk.jdbc.TableState;
-
-/**
- * The MySQL Table Optimizer can optimize MySQL tables. It knows how to optimize
- * for MySQL datbases in particular and how to repari the table if it is
- * corrupted in the process.
- * <p>
- * We will probably be able to abstract out a generic optimizer interface from
- * this class in the future.
- * <p>
- * @author Aaron Smuts
- */
-public class MySQLTableOptimizer
-{
-    private final static Log log = LogFactory.getLog( MySQLTableOptimizer.class );
-
-    private JDBCDiskCachePoolAccess poolAccess = null;
-
-    private String tableName = null;
-
-    private TableState tableState;
-
-    /**
-     * This constructs an optimizer with the disk cacn properties.
-     * <p>
-     * @param attributes
-     * @param tableState
-     *            We mark the table status as optimizing when this is happening.
-     */
-    public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState )
-    {
-        setTableName( attributes.getTableName() );
-
-        this.tableState = tableState;
-        /**
-         * This initializes the pool access.
-         */
-        initializePoolAccess( attributes );
-    }
-
-    /**
-     * Register the driver and create a pool.
-     * <p>
-     * @param cattr
-     */
-    protected void initializePoolAccess( JDBCDiskCacheAttributes cattr )
-    {
-        try
-        {
-            try
-            {
-                // org.gjt.mm.mysql.Driver
-                Class.forName( cattr.getDriverClassName() );
-            }
-            catch ( ClassNotFoundException e )
-            {
-                log.error( "Couldn't find class for driver [" + cattr.getDriverClassName() + "]", e );
-            }
-
-            poolAccess = new JDBCDiskCachePoolAccess( cattr.getName() );
-
-            poolAccess.setupDriver( cattr.getUrl() + cattr.getDatabase(), cattr.getUserName(), cattr.getPassword(),
-                                    cattr.getMaxActive() );
-        }
-        catch ( Exception e )
-        {
-            log.error( "Problem getting connection.", e );
-        }
-    }
-
-    /**
-     * A scheduler will call this method. When it is called the table state is
-     * marked as optimizing. TODO we need to verify that no deletions are
-     * running before we call optimize. We should wait if a deletion is in
-     * progress.
-     * <p>
-     * This restores when there is an optimization error. The error output looks
-     * like this:
-     * 
-     * <pre>
-     *           mysql&gt; optimize table JCS_STORE_FLIGHT_OPTION_ITINERARY;
-     *               +---------------------------------------------+----------+----------+---------------------+
-     *               | Table                                       | Op       | Msg_type | Msg_text            |
-     *               +---------------------------------------------+----------+----------+---------------------+
-     *               | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | optimize | error    | 2 when fixing table |
-     *               | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | optimize | status   | Operation failed    |
-     *               +---------------------------------------------+----------+----------+---------------------+
-     *               2 rows in set (51.78 sec)
-     * </pre>
-     * 
-     * A successful repair response looks like this:
-     * 
-     * <pre>
-     *        mysql&gt; REPAIR TABLE JCS_STORE_FLIGHT_OPTION_ITINERARY;
-     *            +---------------------------------------------+--------+----------+----------------------------------------------+
-     *            | Table                                       | Op     | Msg_type | Msg_text                                     |
-     *            +---------------------------------------------+--------+----------+----------------------------------------------+
-     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | error    | 2 when fixing table                          |
-     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | warning  | Number of rows changed from 131276 to 260461 |
-     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | status   | OK                                           |
-     *            +---------------------------------------------+--------+----------+----------------------------------------------+
-     *            3 rows in set (3 min 5.94 sec)
-     * </pre>
-     * 
-     * A successful optimization looks like this:
-     * 
-     * <pre>
-     *       mysql&gt; optimize table JCS_STORE_DEFAULT;
-     *           +-----------------------------+----------+----------+----------+
-     *           | Table                       | Op       | Msg_type | Msg_text |
-     *           +-----------------------------+----------+----------+----------+
-     *           | jcs_cache.JCS_STORE_DEFAULT | optimize | status   | OK       |
-     *           +-----------------------------+----------+----------+----------+
-     *           1 row in set (1.10 sec)
-     * </pre>
-     * 
-     * @return
-     */
-    public boolean optimizeTable()
-    {
-        long start = System.currentTimeMillis();
-        boolean success = false;
-
-        if ( tableState.getState() == TableState.OPTIMIZATION_RUNNING )
-        {
-            log
-                .warn( "Skipping optimization.  Optimize was called, but the table state indicates that an optimization is currently running." );
-            return false;
-        }
-
-        try
-        {
-            tableState.setState( TableState.OPTIMIZATION_RUNNING );
-            if ( log.isInfoEnabled() )
-            {
-                log.debug( "Optimizing table [" + this.getTableName() + "]" );
-            }
-
-            Connection con;
-            try
-            {
-                con = poolAccess.getConnection();
-            }
-            catch ( SQLException e )
-            {
-                log.error( "Problem getting connection.", e );
-                return false;
-            }
-
-            try
-            {
-                // TEST
-                Statement sStatement = null;
-                try
-                {
-                    sStatement = con.createStatement();
-
-                    ResultSet rs = sStatement.executeQuery( "optimize table " + this.getTableName() );
-
-                    // first row is error, then status
-                    // if there is only one row in the result set, everything
-                    // should be fine.
-                    // This may be mysql version specific.
-                    if ( rs.next() )
-                    {
-                        String status = rs.getString( "Msg_type" );
-                        String message = rs.getString( "Msg_text" );
-
-                        if ( log.isInfoEnabled() )
-                        {
-                            log.info( "Message Type: " + status );
-                            log.info( "Message: " + message );
-                        }
-
-                        if ( "error".equals( status ) )
-                        {
-                            log.warn( "Optimization was in erorr.  Will attempt to repair the table.  Message: "
-                                + message );
-
-                            // try to repair the table.
-                            success = repairTable( sStatement );
-                        }
-                        else
-                        {
-                            success = true;
-                        }
-                    }
-
-                    // log the table status
-                    String statusString = getTableStatus( sStatement );
-                    if ( log.isInfoEnabled() )
-                    {
-                        log.info( "Table status after optimizing table [" + this.getTableName() + "]\n" + statusString );
-                    }
-                }
-                catch ( SQLException e )
-                {
-                    log.error( "Problem optimizing table [" + this.getTableName() + "]", e );
-                    return false;
-                }
-                finally
-                {
-                    try
-                    {
-                        sStatement.close();
-                    }
-                    catch ( SQLException e )
-                    {
-                        log.error( "Problem closing statement.", e );
-                    }
-                }
-            }
-            finally
-            {
-                try
-                {
-                    con.close();
-                }
-                catch ( SQLException e )
-                {
-                    log.error( "Problem closing connection.", e );
-                }
-            }
-        }
-        finally
-        {
-            tableState.setState( TableState.FREE );
-
-            long end = System.currentTimeMillis();
-            if ( log.isInfoEnabled() )
-            {
-                log.info( "Optimization of table [" + this.getTableName() + "] took " + ( end - start ) + " ms." );
-            }
-        }
-
-        return success;
-    }
-
-    /**
-     * This calls show table status and returns the result as a String.
-     * <p>
-     * @param sStatement
-     * @return String
-     * @throws SQLException
-     */
-    protected String getTableStatus( Statement sStatement )
-        throws SQLException
-    {
-        ResultSet statusResultSet = sStatement.executeQuery( "show table status" );
-        StringBuffer statusString = new StringBuffer();
-        int numColumns = statusResultSet.getMetaData().getColumnCount();
-        while ( statusResultSet.next() )
-        {
-            statusString.append( "\n" );
-            for ( int i = 1; i <= numColumns; i++ )
-            {
-                statusString.append( statusResultSet.getMetaData().getColumnLabel( i ) + " ["
-                    + statusResultSet.getString( i ) + "]  |  " );
-            }
-        }
-        return statusString.toString();
-    }
-
-    /**
-     * This is called if the optimizatio is in error.
-     * <p>
-     * It looks for "OK" in response. If it find "OK" as a message in any result
-     * set row, it returns true. Otherwise we assume that the repair failed.
-     * <p>
-     * @param sStatement
-     * @return true if successful
-     * @throws SQLException
-     */
-    protected boolean repairTable( Statement sStatement )
-        throws SQLException
-    {
-        boolean success = false;
-
-        // if( message != null && message.indexOf( ) )
-        ResultSet repairResult = sStatement.executeQuery( "repair table " + this.getTableName() );
-        StringBuffer repairString = new StringBuffer();
-        int numColumns = repairResult.getMetaData().getColumnCount();
-        while ( repairResult.next() )
-        {
-            for ( int i = 1; i <= numColumns; i++ )
-            {
-                repairString.append( repairResult.getMetaData().getColumnLabel( i ) + " [" + repairResult.getString( i )
-                    + "]  |  " );
-            }
-
-            String message = repairResult.getString( "Msg_text" );
-            if ( "OK".equals( message ) )
-            {
-                success = true;
-            }
-        }
-        if ( log.isInfoEnabled() )
-        {
-            log.info( repairString );
-        }
-
-        if ( !success )
-        {
-            log.warn( "Failed to repair the table. " + repairString );
-        }
-        return success;
-    }
-
-    /**
-     * @param tableName
-     *            The tableName to set.
-     */
-    public void setTableName( String tableName )
-    {
-        this.tableName = tableName;
-    }
-
-    /**
-     * @return Returns the tableName.
-     */
-    public String getTableName()
-    {
-        return tableName;
-    }
-}
+package org.apache.jcs.auxiliary.disk.jdbc.mysql;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheAttributes;
+import org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCachePoolAccess;
+import org.apache.jcs.auxiliary.disk.jdbc.TableState;
+
+/**
+ * The MySQL Table Optimizer can optimize MySQL tables. It knows how to optimize
+ * for MySQL datbases in particular and how to repari the table if it is
+ * corrupted in the process.
+ * <p>
+ * We will probably be able to abstract out a generic optimizer interface from
+ * this class in the future.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class MySQLTableOptimizer
+{
+    private final static Log log = LogFactory.getLog( MySQLTableOptimizer.class );
+
+    private JDBCDiskCachePoolAccess poolAccess = null;
+
+    private String tableName = null;
+
+    private TableState tableState;
+
+    /**
+     * This constructs an optimizer with the disk cacn properties.
+     * <p>
+     * @param attributes
+     * @param tableState
+     *            We mark the table status as optimizing when this is happening.
+     */
+    public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState )
+    {
+        setTableName( attributes.getTableName() );
+
+        this.tableState = tableState;
+        /**
+         * This initializes the pool access.
+         */
+        initializePoolAccess( attributes );
+    }
+
+    /**
+     * Register the driver and create a pool.
+     * <p>
+     * @param cattr
+     */
+    protected void initializePoolAccess( JDBCDiskCacheAttributes cattr )
+    {
+        try
+        {
+            try
+            {
+                // org.gjt.mm.mysql.Driver
+                Class.forName( cattr.getDriverClassName() );
+            }
+            catch ( ClassNotFoundException e )
+            {
+                log.error( "Couldn't find class for driver [" + cattr.getDriverClassName() + "]", e );
+            }
+
+            poolAccess = new JDBCDiskCachePoolAccess( cattr.getName() );
+
+            poolAccess.setupDriver( cattr.getUrl() + cattr.getDatabase(), cattr.getUserName(), cattr.getPassword(),
+                                    cattr.getMaxActive() );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Problem getting connection.", e );
+        }
+    }
+
+    /**
+     * A scheduler will call this method. When it is called the table state is
+     * marked as optimizing. TODO we need to verify that no deletions are
+     * running before we call optimize. We should wait if a deletion is in
+     * progress.
+     * <p>
+     * This restores when there is an optimization error. The error output looks
+     * like this:
+     *
+     * <pre>
+     *           mysql&gt; optimize table JCS_STORE_FLIGHT_OPTION_ITINERARY;
+     *               +---------------------------------------------+----------+----------+---------------------+
+     *               | Table                                       | Op       | Msg_type | Msg_text            |
+     *               +---------------------------------------------+----------+----------+---------------------+
+     *               | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | optimize | error    | 2 when fixing table |
+     *               | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | optimize | status   | Operation failed    |
+     *               +---------------------------------------------+----------+----------+---------------------+
+     *               2 rows in set (51.78 sec)
+     * </pre>
+     *
+     * A successful repair response looks like this:
+     *
+     * <pre>
+     *        mysql&gt; REPAIR TABLE JCS_STORE_FLIGHT_OPTION_ITINERARY;
+     *            +---------------------------------------------+--------+----------+----------------------------------------------+
+     *            | Table                                       | Op     | Msg_type | Msg_text                                     |
+     *            +---------------------------------------------+--------+----------+----------------------------------------------+
+     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | error    | 2 when fixing table                          |
+     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | warning  | Number of rows changed from 131276 to 260461 |
+     *            | jcs_cache.JCS_STORE_FLIGHT_OPTION_ITINERARY | repair | status   | OK                                           |
+     *            +---------------------------------------------+--------+----------+----------------------------------------------+
+     *            3 rows in set (3 min 5.94 sec)
+     * </pre>
+     *
+     * A successful optimization looks like this:
+     *
+     * <pre>
+     *       mysql&gt; optimize table JCS_STORE_DEFAULT;
+     *           +-----------------------------+----------+----------+----------+
+     *           | Table                       | Op       | Msg_type | Msg_text |
+     *           +-----------------------------+----------+----------+----------+
+     *           | jcs_cache.JCS_STORE_DEFAULT | optimize | status   | OK       |
+     *           +-----------------------------+----------+----------+----------+
+     *           1 row in set (1.10 sec)
+     * </pre>
+     *
+     * @return
+     */
+    public boolean optimizeTable()
+    {
+        long start = System.currentTimeMillis();
+        boolean success = false;
+
+        if ( tableState.getState() == TableState.OPTIMIZATION_RUNNING )
+        {
+            log
+                .warn( "Skipping optimization.  Optimize was called, but the table state indicates that an optimization is currently running." );
+            return false;
+        }
+
+        try
+        {
+            tableState.setState( TableState.OPTIMIZATION_RUNNING );
+            if ( log.isInfoEnabled() )
+            {
+                log.debug( "Optimizing table [" + this.getTableName() + "]" );
+            }
+
+            Connection con;
+            try
+            {
+                con = poolAccess.getConnection();
+            }
+            catch ( SQLException e )
+            {
+                log.error( "Problem getting connection.", e );
+                return false;
+            }
+
+            try
+            {
+                // TEST
+                Statement sStatement = null;
+                try
+                {
+                    sStatement = con.createStatement();
+
+                    ResultSet rs = sStatement.executeQuery( "optimize table " + this.getTableName() );
+
+                    // first row is error, then status
+                    // if there is only one row in the result set, everything
+                    // should be fine.
+                    // This may be mysql version specific.
+                    if ( rs.next() )
+                    {
+                        String status = rs.getString( "Msg_type" );
+                        String message = rs.getString( "Msg_text" );
+
+                        if ( log.isInfoEnabled() )
+                        {
+                            log.info( "Message Type: " + status );
+                            log.info( "Message: " + message );
+                        }
+
+                        if ( "error".equals( status ) )
+                        {
+                            log.warn( "Optimization was in erorr.  Will attempt to repair the table.  Message: "
+                                + message );
+
+                            // try to repair the table.
+                            success = repairTable( sStatement );
+                        }
+                        else
+                        {
+                            success = true;
+                        }
+                    }
+
+                    // log the table status
+                    String statusString = getTableStatus( sStatement );
+                    if ( log.isInfoEnabled() )
+                    {
+                        log.info( "Table status after optimizing table [" + this.getTableName() + "]\n" + statusString );
+                    }
+                }
+                catch ( SQLException e )
+                {
+                    log.error( "Problem optimizing table [" + this.getTableName() + "]", e );
+                    return false;
+                }
+                finally
+                {
+                    try
+                    {
+                        sStatement.close();
+                    }
+                    catch ( SQLException e )
+                    {
+                        log.error( "Problem closing statement.", e );
+                    }
+                }
+            }
+            finally
+            {
+                try
+                {
+                    con.close();
+                }
+                catch ( SQLException e )
+                {
+                    log.error( "Problem closing connection.", e );
+                }
+            }
+        }
+        finally
+        {
+            tableState.setState( TableState.FREE );
+
+            long end = System.currentTimeMillis();
+            if ( log.isInfoEnabled() )
+            {
+                log.info( "Optimization of table [" + this.getTableName() + "] took " + ( end - start ) + " ms." );
+            }
+        }
+
+        return success;
+    }
+
+    /**
+     * This calls show table status and returns the result as a String.
+     * <p>
+     * @param sStatement
+     * @return String
+     * @throws SQLException
+     */
+    protected String getTableStatus( Statement sStatement )
+        throws SQLException
+    {
+        ResultSet statusResultSet = sStatement.executeQuery( "show table status" );
+        StringBuffer statusString = new StringBuffer();
+        int numColumns = statusResultSet.getMetaData().getColumnCount();
+        while ( statusResultSet.next() )
+        {
+            statusString.append( "\n" );
+            for ( int i = 1; i <= numColumns; i++ )
+            {
+                statusString.append( statusResultSet.getMetaData().getColumnLabel( i ) + " ["
+                    + statusResultSet.getString( i ) + "]  |  " );
+            }
+        }
+        return statusString.toString();
+    }
+
+    /**
+     * This is called if the optimizatio is in error.
+     * <p>
+     * It looks for "OK" in response. If it find "OK" as a message in any result
+     * set row, it returns true. Otherwise we assume that the repair failed.
+     * <p>
+     * @param sStatement
+     * @return true if successful
+     * @throws SQLException
+     */
+    protected boolean repairTable( Statement sStatement )
+        throws SQLException
+    {
+        boolean success = false;
+
+        // if( message != null && message.indexOf( ) )
+        ResultSet repairResult = sStatement.executeQuery( "repair table " + this.getTableName() );
+        StringBuffer repairString = new StringBuffer();
+        int numColumns = repairResult.getMetaData().getColumnCount();
+        while ( repairResult.next() )
+        {
+            for ( int i = 1; i <= numColumns; i++ )
+            {
+                repairString.append( repairResult.getMetaData().getColumnLabel( i ) + " [" + repairResult.getString( i )
+                    + "]  |  " );
+            }
+
+            String message = repairResult.getString( "Msg_text" );
+            if ( "OK".equals( message ) )
+            {
+                success = true;
+            }
+        }
+        if ( log.isInfoEnabled() )
+        {
+            log.info( repairString );
+        }
+
+        if ( !success )
+        {
+            log.warn( "Failed to repair the table. " + repairString );
+        }
+        return success;
+    }
+
+    /**
+     * @param tableName
+     *            The tableName to set.
+     */
+    public void setTableName( String tableName )
+    {
+        this.tableName = tableName;
+    }
+
+    /**
+     * @return Returns the tableName.
+     */
+    public String getTableName()
+    {
+        return tableName;
+    }
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleFormatException.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleFormatException.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleFormatException.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleFormatException.java Thu May 10 09:03:42 2007
@@ -1,20 +1,39 @@
-package org.apache.jcs.auxiliary.disk.jdbc.mysql.util;
-
-/**
- * This is thrown internally by the schedule parser.
- * <p>
- * @author Aaron Smuts
- */
-public class ScheduleFormatException
-    extends Exception
-{
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * @param message
-     */
-    public ScheduleFormatException( String message )
-    {
-        super( message );
-    }
-}
+package org.apache.jcs.auxiliary.disk.jdbc.mysql.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 is thrown internally by the schedule parser.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class ScheduleFormatException
+    extends Exception
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * @param message
+     */
+    public ScheduleFormatException( String message )
+    {
+        super( message );
+    }
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleParser.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleParser.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleParser.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/mysql/util/ScheduleParser.java Thu May 10 09:03:42 2007
@@ -1,92 +1,111 @@
-package org.apache.jcs.auxiliary.disk.jdbc.mysql.util;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.StringTokenizer;
-
-/**
- * Parses the very simple schedule format.
- * <p>
- * @author Aaron Smuts
- */
-public class ScheduleParser
-{
-    /**
-     * For each date time that is separated by a comma in the
-     * OptimizationSchedule, create a date and add it to an array of dates.
-     * <p>
-     * @param schedule
-     * @return Date[]
-     * @throws ScheduleFormatException
-     */
-    public static Date[] createDatesForSchedule( String schedule )
-        throws ScheduleFormatException
-    {
-        if ( schedule == null )
-        {
-            throw new ScheduleFormatException( "Cannot create schedules for a null String." );
-        }
-        
-        StringTokenizer toker = new StringTokenizer( schedule, "," );
-        Date[] dates = new Date[toker.countTokens()];
-        int cnt = 0;
-        while ( toker.hasMoreTokens() )
-        {
-            String time = toker.nextToken();
-            dates[cnt] = getDateForSchedule( time );
-            cnt++;
-        }
-        return dates;
-    }
-
-    /**
-     * For a single string it creates a date that is the next time this hh:mm:ss
-     * combo will be seen.
-     * <p>
-     * @param startTime
-     * @return
-     * @throws ScheduleFormatException
-     */
-    public static Date getDateForSchedule( String startTime )
-        throws ScheduleFormatException
-    {
-        if ( startTime == null )
-        {
-            throw new ScheduleFormatException( "Cannot create date for a null String." );
-        }
-        
-        int firstColon = startTime.indexOf( ":" );
-        int lastColon = startTime.lastIndexOf( ":" );
-        int len = startTime.length();
-        if ( firstColon == -1 || lastColon == -1 || firstColon == lastColon || lastColon == len )
-        {
-            String message = "StartTime [" + startTime + "] is deformed.  Unable to schedule optimizaiton.";
-            throw new ScheduleFormatException( message );
-        }
-
-        Calendar cal = Calendar.getInstance();
-        try
-        {
-            int hour = Integer.parseInt( startTime.substring( 0, firstColon ) );
-            cal.set( Calendar.HOUR_OF_DAY, hour );
-            int minute = Integer.parseInt( startTime.substring( firstColon + 1, lastColon ) );
-            cal.set( Calendar.MINUTE, minute );
-            int second = Integer.parseInt( startTime.substring( lastColon + 1, len ) );
-            cal.set( Calendar.SECOND, second );
-        }
-        catch ( NumberFormatException e )
-        {
-            String message = "Problem parsing start time [" + startTime + "].  It should be in HH:MM:SS format.";
-            throw new ScheduleFormatException( message );
-        }
-
-        // if the date is less than now, add a day.
-        Date now = new Date();
-        if ( cal.getTime().before( now ) )
-        {
-            cal.add( Calendar.DAY_OF_MONTH, 1 );
-        }
-
-        return cal.getTime();
-    }
-}
+package org.apache.jcs.auxiliary.disk.jdbc.mysql.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.Calendar;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+/**
+ * Parses the very simple schedule format.
+ * <p>
+ * @author Aaron Smuts
+ */
+public class ScheduleParser
+{
+    /**
+     * For each date time that is separated by a comma in the
+     * OptimizationSchedule, create a date and add it to an array of dates.
+     * <p>
+     * @param schedule
+     * @return Date[]
+     * @throws ScheduleFormatException
+     */
+    public static Date[] createDatesForSchedule( String schedule )
+        throws ScheduleFormatException
+    {
+        if ( schedule == null )
+        {
+            throw new ScheduleFormatException( "Cannot create schedules for a null String." );
+        }
+
+        StringTokenizer toker = new StringTokenizer( schedule, "," );
+        Date[] dates = new Date[toker.countTokens()];
+        int cnt = 0;
+        while ( toker.hasMoreTokens() )
+        {
+            String time = toker.nextToken();
+            dates[cnt] = getDateForSchedule( time );
+            cnt++;
+        }
+        return dates;
+    }
+
+    /**
+     * For a single string it creates a date that is the next time this hh:mm:ss
+     * combo will be seen.
+     * <p>
+     * @param startTime
+     * @return
+     * @throws ScheduleFormatException
+     */
+    public static Date getDateForSchedule( String startTime )
+        throws ScheduleFormatException
+    {
+        if ( startTime == null )
+        {
+            throw new ScheduleFormatException( "Cannot create date for a null String." );
+        }
+
+        int firstColon = startTime.indexOf( ":" );
+        int lastColon = startTime.lastIndexOf( ":" );
+        int len = startTime.length();
+        if ( firstColon == -1 || lastColon == -1 || firstColon == lastColon || lastColon == len )
+        {
+            String message = "StartTime [" + startTime + "] is deformed.  Unable to schedule optimizaiton.";
+            throw new ScheduleFormatException( message );
+        }
+
+        Calendar cal = Calendar.getInstance();
+        try
+        {
+            int hour = Integer.parseInt( startTime.substring( 0, firstColon ) );
+            cal.set( Calendar.HOUR_OF_DAY, hour );
+            int minute = Integer.parseInt( startTime.substring( firstColon + 1, lastColon ) );
+            cal.set( Calendar.MINUTE, minute );
+            int second = Integer.parseInt( startTime.substring( lastColon + 1, len ) );
+            cal.set( Calendar.SECOND, second );
+        }
+        catch ( NumberFormatException e )
+        {
+            String message = "Problem parsing start time [" + startTime + "].  It should be in HH:MM:SS format.";
+            throw new ScheduleFormatException( message );
+        }
+
+        // if the date is less than now, add a day.
+        Date now = new Date();
+        if ( cal.getTime().before( now ) )
+        {
+            cal.add( Calendar.DAY_OF_MONTH, 1 );
+        }
+
+        return cal.getTime();
+    }
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/package.html
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/package.html?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/package.html (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/package.html Thu May 10 09:03:42 2007
@@ -1,9 +1,27 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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.
+-->
 <html>
   <head>
   </head>
   <body>
-    The primary disk auxiliary. Objects are serialized to a file on disk. 
-    This implementation uses memory keys and performs quite well. 
+    The primary disk auxiliary. Objects are serialized to a file on disk.
+    This implementation uses memory keys and performs quite well.
     Recomended for most cases.
   </body>
 </html>

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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;
@@ -51,7 +54,7 @@
     private ILateralCacheService lateral;
 
     private LateralCacheMonitor monitor;
-        
+
     /**
      * Constructor for the LateralCache object
      * <p>
@@ -138,7 +141,7 @@
     }
 
     /**
-     * 
+     *
      * @param groupName
      * @return A set of group keys.
      */
@@ -192,7 +195,7 @@
 
     /**
      * Synchronously dispose the cache. Not sure we want this.
-     * 
+     *
      * @throws IOException
      */
     public void dispose()
@@ -292,7 +295,7 @@
     {
         if ( lateral != null )
         {
-            this.lateral = lateral;            
+            this.lateral = lateral;
         }
         else
         {
@@ -321,7 +324,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     public String toString()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractFactory.java Thu May 10 09:03:42 2007
@@ -1,80 +1,84 @@
-package org.apache.jcs.auxiliary.lateral;
-
-import org.apache.jcs.auxiliary.AuxiliaryCache;
-import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
-import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
-import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
-import org.apache.jcs.engine.behavior.ICompositeCacheManager;
-
-/*
- * 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.
- */
-
-/**
- * Particular lateral caches should define their own factory.  It is 
- * not necessary to extend this base factory, but it can be useful.
- * <p>
- * The old factory tried to handle all types of laterals.  It was
- * gettting cluttered by ad hoc if statements.  Since the javagroups
- * lateral was jdk1.4 dependent it had to be moved.  As such, the
- * old factory could no longer import it.  This motivated the change.
- * <p>
- * This abstraction layer should keep things cleaner.  
- * <p>
- * @author Aaron Smuts
- */
-public abstract class LateralCacheAbstractFactory
-	implements AuxiliaryCacheFactory
-{
-
-    private String name;
-    
-    /* (non-Javadoc)
-     * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes, org.apache.jcs.engine.behavior.ICompositeCacheManager)
-     */
-    public abstract AuxiliaryCache createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr );
-
-    /**
-     * Makes sure a listener gets created. It will get monitored as soon as it
-     * is used.
-     * <p>
-     * This should be called by create cache.
-     * <p>
-     * @param lac  ILateralCacheAttributes
-     * @param cacheMgr
-     */
-    public abstract void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr );
-        
-    /**
-     * Gets the name attribute of the LateralCacheFactory object
-     * <p>
-     * @return The name value
-     */
-    public String getName()
-    {
-        return this.name;
-    }
-
-    /**
-     * Sets the name attribute of the LateralCacheFactory object
-     * <p>
-     * @param name
-     *            The new name value
-     */
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-}
+package org.apache.jcs.auxiliary.lateral;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.jcs.auxiliary.AuxiliaryCache;
+import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
+import org.apache.jcs.auxiliary.AuxiliaryCacheFactory;
+import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
+import org.apache.jcs.engine.behavior.ICompositeCacheManager;
+
+
+/**
+ * Particular lateral caches should define their own factory.  It is
+ * not necessary to extend this base factory, but it can be useful.
+ * <p>
+ * The old factory tried to handle all types of laterals.  It was
+ * gettting cluttered by ad hoc if statements.  Since the javagroups
+ * lateral was jdk1.4 dependent it had to be moved.  As such, the
+ * old factory could no longer import it.  This motivated the change.
+ * <p>
+ * This abstraction layer should keep things cleaner.
+ * <p>
+ * @author Aaron Smuts
+ */
+public abstract class LateralCacheAbstractFactory
+	implements AuxiliaryCacheFactory
+{
+
+    private String name;
+
+    /* (non-Javadoc)
+     * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes, org.apache.jcs.engine.behavior.ICompositeCacheManager)
+     */
+    public abstract AuxiliaryCache createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr );
+
+    /**
+     * Makes sure a listener gets created. It will get monitored as soon as it
+     * is used.
+     * <p>
+     * This should be called by create cache.
+     * <p>
+     * @param lac  ILateralCacheAttributes
+     * @param cacheMgr
+     */
+    public abstract void createListener( ILateralCacheAttributes lac, ICompositeCacheManager cacheMgr );
+
+    /**
+     * Gets the name attribute of the LateralCacheFactory object
+     * <p>
+     * @return The name value
+     */
+    public String getName()
+    {
+        return this.name;
+    }
+
+    /**
+     * Sets the name attribute of the LateralCacheFactory object
+     * <p>
+     * @param name
+     *            The new name value
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+}

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAbstractManager.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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;
@@ -39,7 +42,7 @@
  * level, distribution and search may need to occur at the lateral cache level.
  * This is currently not implemented in the lateral cache.
  * <p>
- * 
+ *
  * @TODO: - need freeCache, release, getStats - need to find an interface
  *        acceptible for all - cache managers or a manager within a type
  */
@@ -48,7 +51,7 @@
 {
     private final static Log log = LogFactory.getLog( LateralCacheAbstractManager.class );
 
-    /** 
+    /**
      * Each manager instance has caches.
      */
     protected final Map caches = new HashMap();
@@ -72,7 +75,7 @@
 
     /**
      * Adds the lateral cache listener to the underlying cache-watch service.
-     * 
+     *
      * @param cacheName
      *            The feature to be added to the LateralCacheListener attribute
      * @param listener
@@ -98,15 +101,15 @@
      * <p>
      * There should be one manager per server and one cache per region per
      * manager.
-     * 
+     *
      * @return AuxiliaryCache
      * @param cacheName
      */
     public abstract AuxiliaryCache getCache( String cacheName );
-    
+
     /**
      * Gets the cacheType attribute of the LateralCacheManager object
-     * 
+     *
      * @return The cache type value
      */
     public int getCacheType()
@@ -116,7 +119,7 @@
 
     /**
      * Gets the stats attribute of the LateralCacheManager object
-     * 
+     *
      * @return String
      */
     public String getStats()
@@ -127,7 +130,7 @@
 
     /**
      * Fixes up all the caches managed by this cache manager.
-     * 
+     *
      * @param lateralService
      * @param lateralWatch
      */
@@ -148,12 +151,12 @@
             }
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheManager#getCaches()
      */
     public Map getCaches()
     {
         return caches;
-    }    
+    }
 }

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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 +28,7 @@
 /**
  * This class stores attributes for all of the available lateral cache
  * auxiliaries.
- *  
+ *
  */
 public class LateralCacheAttributes
     extends AbstractAuxiliaryCacheAttributes
@@ -35,7 +38,7 @@
     private static final long serialVersionUID = -3408449508837393660L;
 
     private static final boolean DEFAULT_RECEIVE = true;
-    
+
     String transmissionTypeName = "UDP";
 
     int transmissionType = UDP;
@@ -70,7 +73,7 @@
 
     /**
      * Sets the httpServer attribute of the LateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new httpServer value
      */
@@ -81,7 +84,7 @@
 
     /**
      * Gets the httpServer attribute of the LateralCacheAttributes object
-     * 
+     *
      * @return The httpServer value
      */
     public String getHttpServer()
@@ -93,7 +96,7 @@
 
     /**
      * Sets the httpServers attribute of the LateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new httpServers value
      */
@@ -104,7 +107,7 @@
 
     /**
      * Gets the httpSrvers attribute of the LateralCacheAttributes object
-     * 
+     *
      * @return The httpServers value
      */
     public String getHttpServers()
@@ -112,11 +115,11 @@
         return httpServers;
     }
 
-    
+
 
     /**
      * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new tcpListenerPort value
      */
@@ -127,7 +130,7 @@
 
     /**
      * Gets the httpListenerPort attribute of the ILateralCacheAttributes object
-     * 
+     *
      * @return The httpListenerPort value
      */
     public int getHttpListenerPort()
@@ -137,7 +140,7 @@
 
     /**
      * Sets the udpMulticastAddr attribute of the LateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new udpMulticastAddr value
      */
@@ -148,7 +151,7 @@
 
     /**
      * Gets the udpMulticastAddr attribute of the LateralCacheAttributes object
-     * 
+     *
      * @return The udpMulticastAddr value
      */
     public String getUdpMulticastAddr()
@@ -158,7 +161,7 @@
 
     /**
      * Sets the udpMulticastPort attribute of the LateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new udpMulticastPort value
      */
@@ -169,7 +172,7 @@
 
     /**
      * Gets the udpMulticastPort attribute of the LateralCacheAttributes object
-     * 
+     *
      * @return The udpMulticastPort value
      */
     public int getUdpMulticastPort()
@@ -179,7 +182,7 @@
 
     /**
      * Sets the transmissionType attribute of the LateralCacheAttributes object
-     * 
+     *
      * @param val
      *            The new transmissionType value
      */
@@ -210,7 +213,7 @@
 
     /**
      * Gets the transmissionType attribute of the LateralCacheAttributes object
-     * 
+     *
      * @return The transmissionType value
      */
     public int getTransmissionType()
@@ -221,7 +224,7 @@
     /**
      * Sets the transmissionTypeName attribute of the LateralCacheAttributes
      * object
-     * 
+     *
      * @param val
      *            The new transmissionTypeName value
      */
@@ -254,7 +257,7 @@
     /**
      * Gets the transmissionTypeName attribute of the LateralCacheAttributes
      * object
-     * 
+     *
      * @return The transmissionTypeName value
      */
     public String getTransmissionTypeName()
@@ -266,7 +269,7 @@
      * Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When
      * this is true the lateral cache will only issue put and remove order and
      * will not try to retrieve elements from other lateral caches.
-     * 
+     *
      * @param val
      *            The new transmissionTypeName value
      */
@@ -295,7 +298,7 @@
 
     /**
      * Returns a clone of the attributes.
-     * 
+     *
      * @return Self
      */
     public AuxiliaryCacheAttributes copy()
@@ -311,8 +314,8 @@
         return this;
     }
 
-    
-    
+
+
     /**
      * @param receive
      *            The receive to set.
@@ -330,11 +333,11 @@
         return receive;
     }
 
-    
+
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     public String toString()

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheInfo.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheInfo.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheInfo.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheInfo.java Thu May 10 09:03:42 2007
@@ -1,26 +1,29 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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.rmi.dgc.VMID;
 
 /**
  * A shared static variable holder for the lateral cache
- *  
+ *
  */
 public class LateralCacheInfo
 {

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheMonitor.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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.Iterator;
@@ -30,7 +33,7 @@
  * connection error, the monitor changes to operate in a time driven mode. That
  * is, it attempts to recover the connections on a periodic basis. When all
  * failed connections are restored, it changes back to the failure driven mode.
- *  
+ *
  */
 public class LateralCacheMonitor
     implements Runnable
@@ -51,10 +54,10 @@
     private static int mode = ERROR;
 
     private ILateralCacheManager manager;
-    
+
     /**
      * Configures the idle period between repairs.
-     * 
+     *
      * @param idlePeriod
      *            The new idlePeriod value
      */
@@ -69,7 +72,7 @@
     /**
      * Allows close classes, ie testers to set the idle period to something
      * testable.
-     * 
+     *
      * @param idlePeriod
      */
     protected static void forceShortIdlePeriod( long idlePeriod )
@@ -81,7 +84,7 @@
      * <p>
      * It's the clients responsibility to decide how many
      * of these there will be.
-     *  
+     *
      * @param manager
      */
     public LateralCacheMonitor( ILateralCacheManager manager )

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java Thu May 10 09:03:42 2007
@@ -1,12 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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;

Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?view=diff&rev=536904&r1=536903&r2=536904
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Thu May 10 09:03:42 2007
@@ -1,19 +1,22 @@
 package org.apache.jcs.auxiliary.lateral;
 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
  *
- * 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
  *
- *     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.
+ * 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;
@@ -41,7 +44,7 @@
  * Composite factory should construct LateralCacheNoWaitFacade to give to the
  * composite cache out of caches it constructs from the varies manager to
  * lateral services. Perhaps the lateralcache factory should be able to do this.
- *  
+ *
  */
 public class LateralCacheNoWaitFacade
     implements AuxiliaryCache
@@ -56,11 +59,11 @@
     private String cacheName;
 
     private ILateralCacheAttributes lateralCacheAttributes;
-    
+
     /**
      * Constructs with the given lateral cache, and fires events to any
      * listeners.
-     * 
+     *
      * @param noWaits
      * @param cattr
      */
@@ -69,7 +72,7 @@
         if ( log.isDebugEnabled() )
         {
             log.debug( "CONSTRUCTING NO WAIT FACADE" );
-        }        
+        }
         this.noWaits = noWaits;
         this.cacheName = cattr.getCacheName();
         this.lateralCacheAttributes = cattr;
@@ -116,7 +119,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.jcs.engine.behavior.ICache#update(org.apache.jcs.engine.behavior.ICacheElement)
      */
     public void update( ICacheElement ce )
@@ -172,7 +175,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.jcs.auxiliary.AuxiliaryCache#getGroupKeys(java.lang.String)
      */
     public Set getGroupKeys( String group )
@@ -254,7 +257,7 @@
 
     /**
      * No lateral invokation.
-     * 
+     *
      * @return The size value
      */
     public int getSize()
@@ -265,7 +268,7 @@
 
     /**
      * Gets the cacheType attribute of the LateralCacheNoWaitFacade object
-     * 
+     *
      * @return The cacheType value
      */
     public int getCacheType()
@@ -275,7 +278,7 @@
 
     /**
      * Gets the cacheName attribute of the LateralCacheNoWaitFacade object
-     * 
+     *
      * @return The cacheName value
      */
     public String getCacheName()
@@ -287,7 +290,7 @@
     // need to do something with this
     /**
      * Gets the status attribute of the LateralCacheNoWaitFacade object
-     * 
+     *
      * @return The status value
      */
     public int getStatus()
@@ -303,10 +306,10 @@
     {
         return this.lateralCacheAttributes;
     }
-    
+
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     public String toString()
@@ -316,7 +319,7 @@
 
     /**
      * getStats
-     * 
+     *
      * @return String
      */
     public String getStats()
@@ -326,7 +329,7 @@
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see org.apache.jcs.auxiliary.AuxiliaryCache#getStatistics()
      */
     public IStats getStatistics()



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