You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Paulo Gaspar <pa...@krankikom.de> on 2001/03/07 22:48:41 UTC
[PATCH]: ResourceManager bug fix
In the ResourceManager class,
resource.process()
was always (twice) called before the function call
resourceLoader.getLastModified( resource )
that gets the resource timestamp.
The problem is that if (with loads of bad luck) the
resource is updated between these too calls, the old
resource version data would be associated with the
newer version timestamp.
The consequence is that the subsequent timestamp
checks on the resource would give it has not changed.
These patch is not ideal but it is what is possible
with the current architecture (*). It simply consists
in an order change - getting the timestamp before
loading the resource.
Its worse case is that a new version of the resource,
changed (again) between the 2 calls will be loaded
twice - because of the new version data being
associated with the old timestamp.
However, this just results in redundant work on the
very-bad-Murphy-at-work case instead of deficient
functionality (e.g.: an updated template not being
reloaded).
As mentioned before, be aware that text newline
sequences might be wrong for Linux (I'm not sure).
And I am sure it will need some editing to work.
Can some one fix it and apply it?
Thanks and have fun,
Paulo Gaspar
(*) - Anyway, I think it is impossible to read the
contents of a file and its timestamp in a
single step. So, the most frequent case of
the file would always have this limitation,
unlike database stored resources.
RE: [PATCH]: ResourceManager bug fix
Posted by Paulo Gaspar <pa...@krankikom.de>.
Thanks for applying those patches Geir.
On the Linux remark: I want to try it for some years. I already
worked a (very little) bit with Unix systems and - more
important - with people that knew how to use them. So, I am
aware of the advantages... but I am also too much aware of the
time it will take to learn it.
The last advantage I got aware of, was on how much more stable
Linux is. Here, at my job, people consider normal never having
to reboot a server that - to make things harder - generates a
load of dynamic content. Last year, our most loaded server was
rebooted _once_... intentionally (a kernel upgrade or something
like that).
Now, any Windows NT experienced guy reboots a loaded NT4 server
weekly or every other week just to be sure that the software
running on it doesn't crash. (There is a saying that crashing a
piece of software on Windows is just a matter of time - which,
fortunately, is getting longer but is still measurable.)
Anyway, Open Source stuff and Cygnus are giving me a start.
Back to good old command line tools... but for something better
than DOS.
Have fun,
Paulo
> -----Original Message-----
> From: gmj@mta6.srv.hcvlny.cv.net [mailto:gmj@mta6.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
>
> Paulo Gaspar wrote:
>
> ...
>
> > As mentioned before, be aware that text newline
> > sequences might be wrong for Linux (I'm not sure).
> > And I am sure it will need some editing to work.
>
> You should give Linux a whirl. You can't beat the pricepoint...
>
>...
Re: [PATCH]: ResourceManager bug fix
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Paulo Gaspar wrote:
>
> In the ResourceManager class,
> resource.process()
> was always (twice) called before the function call
> resourceLoader.getLastModified( resource )
> that gets the resource timestamp.
>
> The problem is that if (with loads of bad luck) the
> resource is updated between these too calls, the old
> resource version data would be associated with the
> newer version timestamp.
Yes, that would be loads of bad luck. But its true - its possible.
>
> The consequence is that the subsequent timestamp
> checks on the resource would give it has not changed.
>
> These patch is not ideal but it is what is possible
> with the current architecture (*). It simply consists
> in an order change - getting the timestamp before
> loading the resource.
>
> Its worse case is that a new version of the resource,
> changed (again) between the 2 calls will be loaded
> twice - because of the new version data being
> associated with the old timestamp.
Right - and that is acceptable as it beats the other issue, of not
having the most up-to-date resource data.
> However, this just results in redundant work on the
> very-bad-Murphy-at-work case instead of deficient
> functionality (e.g.: an updated template not being
> reloaded).
>
> As mentioned before, be aware that text newline
> sequences might be wrong for Linux (I'm not sure).
> And I am sure it will need some editing to work.
You should give Linux a whirl. You can't beat the pricepoint...
> Can some one fix it and apply it?
Done.
> Thanks and have fun,
Always do.
geir
--
Geir Magnusson Jr. geirm@optonline.net
Developing for the web? See http://jakarta.apache.org/velocity/