W3C home > Mailing lists > Public > www-jigsaw@w3.org > September to October 1996

Life span of a resource

From: Anselm Baird-Smith <abaird@w3.org>
Date: Mon, 7 Oct 1996 12:04:30 -0400 (EDT)
Message-Id: <199610071604.MAA18034@anansi.w3.org>
To: "mailing list receiver" <bulk@digipub.be>
Cc: "jigsaw" <www-jigsaw@w3.org>
mailing list receiver writes:
 > Hello,
 > Could someone clear the fog for me please ;-)
 > 1. When is a resource actually instantiated?
 > - Is the resource instantiated every time it is invoked,
 > is it instantiated once at jigsaw startup,
 > is it instantiated once at first invocation?

A resource is instantiated at first invocation. This doesn't mean
*once* ! Jigsaw has a "clever" way of unloading resources from memory
when it thinks it is getting low of it. Whant really happens is:

- On first hit to the resource Jigsaw instantiate it
- loop: 
  while ( server isrunning ) {
       - If memory is low, Jigsaw unloads it
       - If hit again, it is re-instantiated

 > 2. If i use a static variable in a resource, can I be
 > sure that it stays there untill jigsaw shuts down?

No, usually it will (because Jigsaw doesn't often think it 's getting
low of memory), but you should not assume this will be true

 > 3. Is there a method in the resource that's
 > being called when jigsaw shuts down (for resource cleanup)?
 > finalize() does the job, but only when
 > garbage is collected ...

Well, there is a mean to do that. When Jigsaw unload a resource
(perhaps because it is shut down, or because memory is low), it runs
through the following steps:

a) If some of the resource attributes have been modified, it saves it
b) If any resource locker exists for that resource, it notifies them

In your case, you probably want to use b), by registering a resource
locker for the resource you want to monitor. Check:


Received on Monday, 7 October 1996 12:04:47 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:30 UTC