jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Forbes" <forbes...@googlemail.com>
Subject Remote cache and serialization issues.
Date Fri, 19 Dec 2008 16:12:04 GMT
Hi,

When cache gets a serialization error it directly tries to switch to the
backup remote cache. A serialization error is not an indication that the
cache is not functioning correctly - just that the data is invalid. So I
don't think that this error should trigger a switch to backup.


Dec 18 09:09:17 eul0300354 [2008-12-18 09:09:16,477]
org.apache.jcs.auxiliary.remote.RemoteCache ERROR  - *Disabling remote cache
due to error:* Failed to get [testKey] from [fareCache]
Dec 18 09:09:17 eul0300354 java.io.InvalidClassException:
com.ee.ibe.buslogic.PriceLine; local class incompatible: stream classdesc
serialVersionUID = 1, local class serialVersionUID = 2
Dec 18 09:09:17 eul0300354     at
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
Dec 18 09:09:17 eul0300354     at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
Dec 18 09:09:17 eul0300354     at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
Dec 18 09:09:17 eul0300354     at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
Dec 18 09:09:18 eul0300354     at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)

In the method
   protected void handleException( Exception ex, String msg, String
eventName )
could we have the following change? There may be an alternative to catching
serialization errors earlier, but this seems to be the simplest change. See
what you think.


Index: src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java
===================================================================
--- src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java    (revision
727672)
+++ src/java/org/apache/jcs/auxiliary/remote/RemoteCache.java    (working
copy)
@@ -124,6 +124,17 @@
         logError( cacheName, "", message );
         log.error( message, ex );

+        /** For serialization errors, there is no problem with the remote
+         * cache, so we don't do the failover.
+         * Errors are usually of the form:
+         * local class incompatible: stream classdesc serialVersionUID = 1,

+         *                           local class serialVersionUID = 2
+         */
+        if ( ex instanceof java.io.InvalidClassException )
+        {
+            return;
+        }
+
         // we should not switch if the existing is a zombie.
         if ( getRemoteCacheService() == null || !( getRemoteCacheService()
instanceof ZombieRemoteCacheService ) )
         {



Regards,
Al

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message