Here I go again...


The is a waste of performance and a bug on resource loading
in the ResourceManager class.

* The Bug *

In ResourceManager.getResource(), loading a resource with
  resource.process();
always happens before reading its "LastModified" timestamp
with
  resource.setLastModified(resourceLoader.getLastModified(resource));

The bug is that this can cause a change to become undetected
if one has this sequence of events:
  1 - resource is loaded;
  2 - resource is changed at its source (file or other);
  3 - timestamp is red.

In 3, this would be the timestamp of the new version instead
of the old. Further timestamp checks would not detect the 
change because the timestamp red does NOT belong to the 
resource red.


* The performance waste *

Besides consistency advantages, it is usually faster to read 
the resource's text and its timestamp in a single operation. 
This is especially obvious with database resource loaders
like David's (2 database operations instead of one in order
to load a template).

However, the current ResourceManager/ResourceLoader 
mechanism does not allow that.


Have fun,
Paulo Gaspar

Reply via email to