Hi Antonio, I'm trying this out as we speak. So far I've not had any success in getting the index written out. I'll keep you all updated.
Corin -----Original Message----- From: Antonio Gallardo [mailto:[EMAIL PROTECTED] Sent: Wednesday, 14 April 2004 6:48 p.m. To: [EMAIL PROTECTED] Subject: [Apache JCS] - Fixed diskcache key storage shutdown bug. Hi: I remember concerns about the auxiliary disk Cache in JCS. I think we was waiting for these fix in Apache JCS. Would be fine if Cocoon gurus in this area can test this fix and if this is the last issue related to JCS, then we can start seriously thinking in the repleacement of our old Cache System in Cocoon. ;-) WDYT? Best Regards, Antonio Gallardo ---------------------------- Mensaje Original ---------------------------- Asunto: cvs commit: jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk AbstractDiskCache.java De: asmuts.en.apache.org Fecha: Mi�, 14 de Abril de 2004, 0:24 Para: [EMAIL PROTECTED] -------------------------------------------------------------------------- asmuts 2004/04/13 23:24:18 Modified: src/java/org/apache/jcs/auxiliary/disk/indexed IndexedDiskCache.java IndexedDisk.java src/java/org/apache/jcs/auxiliary/disk AbstractDiskCache.java Log: Fixed diskcache key storage shutdown bug. Added debugging information. I think there is a problem if stuff is being written to disk during the final stage of the optimization. This should be easy to fix. I also need to make sure that the maxlife parameter is getting stored properly. Revision Changes Path 1.8 +33 -10 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Index: IndexedDiskCache.java =================================================================== RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDiskCache.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- IndexedDiskCache.java 22 Aug 2003 11:57:17 -0000 1.7 +++ IndexedDiskCache.java 14 Apr 2004 06:24:18 -0000 1.8 @@ -175,6 +175,11 @@ { storageLock.writeLock(); + if ( log.isInfoEnabled() ) + { + log.info( "loading keys for " + keyFile.toString() ); + } + try { keyHash = ( HashMap ) keyFile.readObject( 0 ); @@ -184,11 +189,24 @@ keyHash = new HashMap(); } - if ( log.isDebugEnabled() ) + if ( log.isInfoEnabled() ) { - log.debug( "Loaded keys from: " + fileName + + log.info( "Loaded keys from: " + fileName + ", key count: " + keyHash.size() ); } + + if ( log.isDebugEnabled() ) + { + Iterator itr = keyHash.entrySet().iterator(); + while ( itr.hasNext() ) + { + Map.Entry e = (Map.Entry)itr.next(); + String key = (String)e.getKey(); + IndexedDiskElementDescriptor de = (IndexedDiskElementDescriptor)e.getValue(); + log.debug( "key entry: " + key + ", ded.pos" + de.pos + ", ded.len" + de.len ); + } + } + } catch ( Exception e ) { @@ -589,9 +607,9 @@ IndexedDisk dataFileTemp = new IndexedDisk( new File( rafDir, fileName + "Temp.data" ) ); - if ( log.isDebugEnabled() ) + if ( log.isInfoEnabled() ) { - log.info( "optomizing file keyHash.size()=" + keyHash.size() ); + log.info( "Optomizing file keyHash.size()=" + keyHash.size() ); } Iterator itr = keyHash.keySet().iterator(); @@ -603,16 +621,21 @@ CacheElement tempDe = ( CacheElement ) readElement( key ); try { - IndexedDiskElementDescriptor de = - dataFileTemp.appendObject( tempDe ); + //IndexedDiskElementDescriptor de = + // dataFileTemp.appendObject( tempDe ); + + IndexedDiskElementDescriptor ded = new IndexedDiskElementDescriptor(); + byte[] data = IndexedDisk.serialize( tempDe ); + ded.init( dataFileTemp.length(), data ); + dataFileTemp.write( data, ded.pos ); if ( log.isDebugEnabled() ) { - log.debug( "Put to temp disk cache: " + fileName + - ", key: " + key ); + log.debug( "Optomize: Put to temp disk cache: " + fileName + + ", key: " + key + ", ded.pos:" + ded.pos + ", ded.len:" + ded.len); } - keyHashTemp.put( key, de ); + keyHashTemp.put( key, ded ); } catch ( Exception e ) { 1.4 +1 -1 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java Index: IndexedDisk.java =================================================================== RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/indexed/IndexedDisk.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- IndexedDisk.java 22 Aug 2003 11:57:17 -0000 1.3 +++ IndexedDisk.java 14 Apr 2004 06:24:18 -0000 1.4 @@ -127,7 +127,7 @@ } if ( corrupted ) { - log.debug( "The datFile is corrupted" ); + log.warn( "The dataFile is corrupted!" ); //reset(); return null; } 1.18 +4 -2 jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java Index: AbstractDiskCache.java =================================================================== RCS file: /home/cvs/jakarta-turbine-jcs/src/java/org/apache/jcs/auxiliary/disk/AbstractDiskCache.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- AbstractDiskCache.java 22 Aug 2003 11:57:18 -0000 1.17 +++ AbstractDiskCache.java 14 Apr 2004 06:24:18 -0000 1.18 @@ -299,7 +299,6 @@ */ public final void dispose() { - alive = false; // Invoke any implementation specific disposal code @@ -308,6 +307,9 @@ // FIXME: May lose the end of the queue, need to be more graceful cacheEventQueue.destroy(); + + alive = false; + } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ================================================================ CAUTION: This e-mail and any attachment(s) contains information that is intended to be read only by the named recipient(s). It may contain information that is confidential, proprietary or the subject of legal privilege. This information is not to be used by any other person and/or organisation. If you are not the intended recipient, please advise us immediately and delete this e-mail from your system. Do not use any information contained in it. ================================================================ For more information on the Television New Zealand Group, visit us online at http://www.tvnz.co.nz ================================================================
