Re: SimpleResourceStore.markUsed()

[NOTE: I sent this reply directly to Anselm by mistake, I meant to send it
to the list.  Anselm, please ignore the repetition if you've read this
already.]

>I am wondering how you fall into a situation were this
>needs to be done. The intent for that API was that only a resource
>itself knows wether it has changed or not, hence calls to markUsed can
>only occur within a resource that just changed.

Exactly.  Right now, resources cannot mark their own resource stores as
used without making an assumption as to what class of resource store they
are associated with, or doing a very ugly if-then sequence that has to know
about all possible resource store subclasses.

Here's how we got into this trouble:

It's possible for resources to act kind of like "master resources",
performing changes on other resources through their legitimate APIs.  If a
so-called "master resource" changes thousands of other resources, then the
changed resources get marked as used, but the master resource itself finds
itself on the wrong end of the LRU list before long, unless it can mark
itself as used.  Marking itself as used is problematic as described above.

Imagine a resource that, in response to a single HTTP request, initiates a
process that actually generates thousands of new resources.  There's a root
container into which it is installing several bushy trees.  It wants to
make sure that:

a) the "master resource" itself is not swapped out, and
b) the root container is not swapped out

One way to do this is with resource lockers.  But can the master resource
lock itself?  (I haven't really figured out whether this is a problem.)  A
way around this is for the resource to mark itself as used periodically
during the generation process, keeping itself from hitting the, er,
razor-sharp, rotating knives awaiting it at the end of the LRU list.



+---------------------+-------------------------+---------------------+
|    Dave Makower     |    davemak@pencom.com   |   WWW Specialist    |
+---------------------+-------------------------+---------------------+
|     Co-author of "Java Programming Basics" (Henry Holt/MIS:Press)   |
|                 http://www.pencom.com/javabasics/                   |
+----------------------------------+----------------------------------+
|   Pencom Web Works               |   (212) 513-7777   voice         |
|   40 Fulton St.                  |   (212) 513-1014   fax           |
|   New York, NY  10038            |   http://www.pencom.com/         |
+----------------------------------+----------------------------------+

Received on Thursday, 24 July 1997 10:52:41 UTC