[jdom-interest] Any ideas? Document/File modification link ...
Jason Hunter
jhunter at servlets.com
Sun Jun 30 22:49:14 PDT 2002
The way I did this on another project was the cache class would check on
access whether the backing data (the file) had changed, and if so
refresh itself before returning its data. The cache held an internal
timer for how often it should check, so if the last check was within X
then it wouldn't bother.
Seems odd to me to extend File for this, since File in Java doesn't
really have any idea about its contents. The File could use a timer to
poll, but then if the cache isn't actively used the file's still pinging
the filesystem every so often needlessly.
-jh-
Jon Baer wrote:
>
> Can someone offer some good insight as to whether or not I am doing this
> right ...
>
> Basically what Im trying to do is extend java.io.File with a single
> method/thread of addListener() is listen for modification times to
> lastModified of the file being built into a JDOM Document.
>
> So basically ...
>
> SFile file = new SFile("file1.xml");
> file.addListener(this);
> Document doc = new Document(file);
> // etc, etc, etc.
>
> public void fileUpdated(FileEvent fe) {
> }
>
> Is there an easier/correct way to synronize the document w/ it's file
> like this? Im not sure if Im asking the question the right way but
> basically the modification needs to update the document in a cache
> accordingly and this seems to be the only way I can think of doing it.
>
> - Jon
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list