Author: asmuts
Date: Wed May  3 15:37:04 2006
New Revision: 399469

URL: http://svn.apache.org/viewcvs?rev=399469&view=rev
Log:
Fixed bug where the remote cache client tried to de-serialize the payload when 
it was in cluster mode.  Cluster remote cache clients no longer try to 
deserialize.  

Modified:
    jakarta/jcs/trunk/project.xml
    
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
    
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
    
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
    
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
    jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
    jakarta/jcs/trunk/src/test-conf/TestJDBCDiskCacheShrink.ccf
    jakarta/jcs/trunk/src/test-conf/log4j.properties
    
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
    
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java

Modified: jakarta/jcs/trunk/project.xml
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/project.xml?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- jakarta/jcs/trunk/project.xml (original)
+++ jakarta/jcs/trunk/project.xml Wed May  3 15:37:04 2006
@@ -5,7 +5,7 @@
        <pomVersion>3</pomVersion>
        <name>JCS</name>
        <id>jcs</id>
-       <currentVersion>1.2.7.3</currentVersion>
+       <currentVersion>1.2.7.4</currentVersion>
        <organization>
                <name>Apache Software Foundation</name>
                <url>http://jakarta.apache.org/</url>

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
 (original)
+++ 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
 Wed May  3 15:37:04 2006
@@ -1110,4 +1110,13 @@
 
         return stats;
     }
+    
+    
+    /**
+     * For debugging.
+     */
+    public String toString()
+    {
+       return this.getStats();
+    }        
 }

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
 (original)
+++ 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheAttributes.java
 Wed May  3 15:37:04 2006
@@ -204,10 +204,7 @@
      */
     public void setShrinkerIntervalSeconds( int shrinkerIntervalSecondsArg )
     {
-        if ( shrinkerIntervalSecondsArg > 1 )
-        {
-            this.shrinkerIntervalSeconds = shrinkerIntervalSecondsArg;
-        }
+        this.shrinkerIntervalSeconds = shrinkerIntervalSecondsArg;
     }
 
     /**

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
 (original)
+++ 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheManager.java
 Wed May  3 15:37:04 2006
@@ -62,6 +62,10 @@
      */
     private JDBCDiskCacheManager( JDBCDiskCacheAttributes cattr )
     {
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Creating JDBCDiskCacheManager with " + cattr );
+        }
         defaultCattr = cattr;
     }
 
@@ -151,7 +155,12 @@
             if ( shrinkerThread == null )
             {
                 shrinkerThread = new ShrinkerThread();
-                shrinkerDaemon.executePeriodically( 
cattr.getShrinkerIntervalSeconds() * 1000, shrinkerThread, false );
+                long intervalMillis = Math.max( 999, 
cattr.getShrinkerIntervalSeconds() * 1000 );
+                if ( log.isInfoEnabled() )
+                {
+                    log.info( "Setting the shrinker to run every [" + 
intervalMillis + "] ms." );
+                }
+                shrinkerDaemon.executePeriodically( intervalMillis, 
shrinkerThread, false );
             }
             shrinkerThread.addDiskCacheToShrinkList( (JDBCDiskCache) raf );
         }

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
 (original)
+++ 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/jdbc/ShrinkerThread.java
 Wed May  3 15:37:04 2006
@@ -77,11 +77,15 @@
             for ( int i = 0; i < caches.length; i++ )
             {
                 JDBCDiskCache cache = (JDBCDiskCache) caches[i];
+
+                long start = System.currentTimeMillis();
                 int deleted = cache.deleteExpired();
+                long end = System.currentTimeMillis();
 
                 if ( log.isInfoEnabled() )
                 {
-                    log.info( "Deleted [" + deleted + "] expired for region [" 
+ cache.getCacheName() + "]" );
+                    log.info( "Deleted [" + deleted + "] expired for region [" 
+ cache.getCacheName() + "] in "
+                        + ( end - start ) + " ms." );
                 }
 
                 // don't pause after the last call to delete expired.

Modified: 
jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java 
(original)
+++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java 
Wed May  3 15:37:04 2006
@@ -256,8 +256,16 @@
             // Eventually the instance of will not be necessary.
             if ( retVal != null && retVal instanceof ICacheElementSerialized )
             {
-                retVal = 
SerializationConversionUtil.getDeSerializedCacheElement( 
(ICacheElementSerialized) retVal,
-                                                                               
   this.elementSerializer );
+                // Never try to deserialize if you are a cluster client. 
Cluster
+                // clients
+                // intra-remote cache communicators. Remote caches are assumed
+                // to have no
+                // ability to deserialze the objects.
+                if ( this.irca.getRemoteType() != 
IRemoteCacheAttributes.CLUSTER )
+                {
+                    retVal = 
SerializationConversionUtil.getDeSerializedCacheElement( 
(ICacheElementSerialized) retVal,
+                                                                               
       this.elementSerializer );
+                }
             }
         }
         catch ( Exception ex )

Modified: jakarta/jcs/trunk/src/test-conf/TestJDBCDiskCacheShrink.ccf
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test-conf/TestJDBCDiskCacheShrink.ccf?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/TestJDBCDiskCacheShrink.ccf (original)
+++ jakarta/jcs/trunk/src/test-conf/TestJDBCDiskCacheShrink.ccf Wed May  3 
15:37:04 2006
@@ -48,9 +48,9 @@
 jcs.auxiliary.JDBC.attributes.driverClassName=org.hsqldb.jdbcDriver
 jcs.auxiliary.JDBC.attributes.tableName=JCS_STORE_SHRINK
 jcs.auxiliary.JDBC.attributes.testBeforeInsert=false
-jcs.auxiliary.JDBC.attributes.maxActive=15
+jcs.auxiliary.JDBC.attributes.maxActive=14
 jcs.auxiliary.JDBC.attributes.allowRemoveAll=true
-jcs.auxiliary.JDBC.attributes.MaxPurgatorySize=10000000
+jcs.auxiliary.JDBC.attributes.MaxPurgatorySize=9999
 jcs.auxiliary.JDBC.attributes.UseDiskShrinker=true
 jcs.auxiliary.JDBC.attributes.ShrinkerIntervalSeconds=1
 jcs.auxiliary.JDBC.attributes.EventQueueType=POOLED
@@ -61,9 +61,9 @@
 ################## OPTIONAL THREAD POOL CONFIGURATION #########
 # Disk Cache pool
 thread_pool.disk_cache_event_queue.useBoundary=false
-thread_pool.disk_cache_event_queue.boundarySize=500
-thread_pool.disk_cache_event_queue.maximumPoolSize=15
-thread_pool.disk_cache_event_queue.minimumPoolSize=10
-thread_pool.disk_cache_event_queue.keepAliveTime=3500
+thread_pool.disk_cache_event_queue.boundarySize=501
+thread_pool.disk_cache_event_queue.maximumPoolSize=13
+thread_pool.disk_cache_event_queue.minimumPoolSize=11
+thread_pool.disk_cache_event_queue.keepAliveTime=35010
 thread_pool.disk_cache_event_queue.whenBlockedPolicy=RUN
-thread_pool.disk_cache_event_queue.startUpSize=10
+thread_pool.disk_cache_event_queue.startUpSize=9

Modified: jakarta/jcs/trunk/src/test-conf/log4j.properties
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test-conf/log4j.properties?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- jakarta/jcs/trunk/src/test-conf/log4j.properties (original)
+++ jakarta/jcs/trunk/src/test-conf/log4j.properties Wed May  3 15:37:04 2006
@@ -4,7 +4,7 @@
 log4j.category.org.apache.jcs.config=INFO
 log4j.category.org.apache.jcs.engine=INFO
 log4j.category.org.apache.jcs.engine.CacheEventQueueFactory=INFO
-#log4j.category.org.apache.jcs.auxiliary.disk=DEBUG
+log4j.category.org.apache.jcs.auxiliary.disk.jdbc=DEBUG
 log4j.category.org.apache.jcs.auxiliary.disk=INFO
 log4j.category.org.apache.jcs.auxiliary.remote=INFO
 log4j.category.org.apache.jcs.auxiliary.lateral=INFO
@@ -13,7 +13,7 @@
 
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c{1}] - <%m>%n
 
 log4j.appender.logfile=org.apache.log4j.RollingFileAppender
 log4j.appender.logfile.File=target/test-sandbox/logs/jcs.log
@@ -22,5 +22,5 @@
 log4j.appender.logfile.MaxBackupIndex=3
 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
 #Pattern to output : date priority [category] - <message>line_separator
-log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
+log4j.appender.logfile.layout.ConversionPattern=%d %p [%c{1}] - <%m>%n
 

Modified: 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
 (original)
+++ 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheShrinkUnitTest.java
 Wed May  3 15:37:04 2006
@@ -77,7 +77,7 @@
         System.out.println( jcsExpire.getStats() );
 
         // the shrinker is supposed to run every second
-        Thread.sleep( 2000 );
+        Thread.sleep( 3000 );
 
         System.out.println( jcsExpire.getStats() );
 

Modified: 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
URL: 
http://svn.apache.org/viewcvs/jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java?rev=399469&r1=399468&r2=399469&view=diff
==============================================================================
--- 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
 (original)
+++ 
jakarta/jcs/trunk/src/test/org/apache/jcs/auxiliary/disk/jdbc/JDBCDiskCacheUnitTest.java
 Wed May  3 15:37:04 2006
@@ -162,7 +162,7 @@
             }
         }
 
-        String setupData[] = { "create index iKEY on JCS_STORE (CACHE_KEY, 
REGION)" };
+        String setupData[] = { "create index iKEY on JCS_STORE2 (CACHE_KEY, 
REGION)" };
 
         if ( newT )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to