sgala 02/01/17 02:56:27 Modified: src/java/org/apache/jetspeed/portal/expire FileWatcher.java Log: This and next change address the following problem (reported by definete.com). When memory cache entry gets created, two broken things happen: 1. No FileWatcher is created until getExpired is called 2. FileWatcher does not fill lastModified upon creation So, if a file is modified on disk between portlet instantiation and next request, the portlet will not be expired. Patch: set lastModified in FileWatcher constructor, and call getExpire in Cacheable creation. Note: memory cache is very broken. It really needs a rewriting with cleaner interfaces. Revision Changes Path 1.11 +9 -7 jakarta-jetspeed/src/java/org/apache/jetspeed/portal/expire/FileWatcher.java Index: FileWatcher.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/expire/FileWatcher.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- FileWatcher.java 16 Oct 2001 11:06:46 -0000 1.10 +++ FileWatcher.java 17 Jan 2002 10:56:27 -0000 1.11 @@ -71,7 +71,7 @@ A generic class for watching a file and determining if it has changed. @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a> -@version $Id: FileWatcher.java,v 1.10 2001/10/16 11:06:46 sgala Exp $ +@version $Id: FileWatcher.java,v 1.11 2002/01/17 10:56:27 sgala Exp $ */ public class FileWatcher { @@ -107,7 +107,7 @@ @see #FileWatcher( String, String ) @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a> - @version $Id: FileWatcher.java,v 1.10 2001/10/16 11:06:46 sgala Exp $ + @version $Id: FileWatcher.java,v 1.11 2002/01/17 10:56:27 sgala Exp $ */ public FileWatcher( String url ) throws IOException { this( url, null ); @@ -117,7 +117,7 @@ Create a new FileWatcher to watch the given URL. @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a> - @version $Id: FileWatcher.java,v 1.10 2001/10/16 11:06:46 sgala Exp $ + @version $Id: FileWatcher.java,v 1.11 2002/01/17 10:56:27 sgala Exp $ */ public FileWatcher( String url, String parent ) throws IOException { @@ -130,9 +130,13 @@ DiskCacheUtils.isCached( url ) == false ) { throw new IOException( EXCEPTION_URL_NOT_IN_CACHE + url ); - } + //Try to set last modified when creating FileWatcher objet + try { + this.lastModified = JetspeedDiskCache.getInstance().getEntry( url ). + getLastModified(); + } catch (Throwable e) {} this.url = url; this.parent = parent; @@ -142,7 +146,7 @@ Return true if the URL on which this is based has changed. @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a> - @version $Id: FileWatcher.java,v 1.10 2001/10/16 11:06:46 sgala Exp $ + @version $Id: FileWatcher.java,v 1.11 2002/01/17 10:56:27 sgala Exp $ */ public boolean hasChanged() { @@ -184,8 +188,6 @@ Log.error( e ); return false; } - - //default should be to not expire. This is set if the URL is null return false;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
