Return-Path: Delivered-To: apmail-jakarta-jcs-dev-archive@www.apache.org Received: (qmail 50278 invoked from network); 5 Jun 2006 13:44:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jun 2006 13:44:06 -0000 Received: (qmail 50147 invoked by uid 500); 5 Jun 2006 13:44:06 -0000 Delivered-To: apmail-jakarta-jcs-dev-archive@jakarta.apache.org Received: (qmail 50067 invoked by uid 500); 5 Jun 2006 13:44:06 -0000 Mailing-List: contact jcs-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JCS Developers List" Delivered-To: mailing list jcs-dev@jakarta.apache.org Received: (qmail 50040 invoked by uid 500); 5 Jun 2006 13:44:05 -0000 Delivered-To: apmail-jakarta-jcs-commits@jakarta.apache.org Received: (qmail 50023 invoked by uid 500); 5 Jun 2006 13:44:05 -0000 Delivered-To: apmail-jakarta-jcs-cvs@jakarta.apache.org Received: (qmail 50011 invoked by uid 99); 5 Jun 2006 13:44:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 06:44:05 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 06:44:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 4FB171A983A; Mon, 5 Jun 2006 06:43:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r411785 - /jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Date: Mon, 05 Jun 2006 13:43:43 -0000 To: jcs-cvs@jakarta.apache.org From: asmuts@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060605134344.4FB171A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: asmuts Date: Mon Jun 5 06:43:43 2006 New Revision: 411785 URL: http://svn.apache.org/viewvc?rev=411785&view=rev Log: fixed deserialization problem when running inside the remote cache. The disk cache was not casting to the ICacheElement interface. It was using the CacheElement implementation, but the wrapper was the special remote cache element. Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Modified: jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java URL: http://svn.apache.org/viewvc/jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=411785&r1=411784&r2=411785&view=diff ============================================================================== --- jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original) +++ jakarta/jcs/trunk/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Mon Jun 5 06:43:43 2006 @@ -35,7 +35,6 @@ import org.apache.jcs.auxiliary.disk.AbstractDiskCache; import org.apache.jcs.auxiliary.disk.LRUMapJCS; import org.apache.jcs.engine.CacheConstants; -import org.apache.jcs.engine.CacheElement; import org.apache.jcs.engine.behavior.ICacheElement; import org.apache.jcs.engine.control.group.GroupAttrName; import org.apache.jcs.engine.control.group.GroupId; @@ -95,7 +94,7 @@ private int recycleCnt = 0; private int startupSize = 0; - + /** * use this lock to synchronize reads and writes to the underlying storage * mechansism. @@ -181,7 +180,7 @@ { log.error( "Failure initializing for fileName: " + fileName + " and root directory: " + rootDirName, e ); } - + ShutdownHook shutdownHook = new ShutdownHook(); Runtime.getRuntime().addShutdownHook( shutdownHook ); } @@ -374,7 +373,7 @@ byte[] data = IndexedDisk.serialize( ce ); // make sure this only locks for one particular cache region - storageLock.writeLock().acquire(); + storageLock.writeLock().acquire(); try { ded.init( dataFile.length(), data ); @@ -427,7 +426,7 @@ } finally - { + { storageLock.writeLock().release(); } @@ -508,10 +507,10 @@ * @return * @throws IOException */ - private CacheElement readElement( Serializable key ) + private ICacheElement readElement( Serializable key ) throws IOException { - CacheElement object = null; + ICacheElement object = null; IndexedDiskElementDescriptor ded = (IndexedDiskElementDescriptor) keyHash.get( key ); @@ -523,14 +522,18 @@ } try { - object = (CacheElement) dataFile.readObject( ded.pos ); + object = (ICacheElement) dataFile.readObject( ded.pos ); } catch ( IOException e ) { - log.error( "Problem reading object from file" ); + log.error( "IO Exception, Problem reading object from file", e ); throw e; } - + catch ( Exception e ) + { + log.error( "Exception, Problem reading object from file", e ); + throw new IOException( "Problem reading object from disk. " + e.getMessage() ); + } } return object; @@ -1126,7 +1129,7 @@ throws Exception { - CacheElement tempDe = null; + ICacheElement tempDe = null; try { tempDe = readElement( key ); @@ -1453,25 +1456,26 @@ } } - + /** * Called on shutdown - * + * * @author Aaron Smuts - * + * */ - class ShutdownHook extends Thread + class ShutdownHook + extends Thread { - + public void run() { if ( alive ) { log.info( "Disk cache was not shutdown properly. Will try to dispose." ); - + doDispose(); - } + } } - + } } --------------------------------------------------------------------- To unsubscribe, e-mail: jcs-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: jcs-dev-help@jakarta.apache.org