Re: Life span of a resource

On Sun, 6 Oct 1996, mailing list receiver wrote:

> 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?
>
It appears to me that resources are instantiated when first invoked.
(More below).

> 2. If i use a static variable in a resource, can I be
> sure that it stays there untill jigsaw shuts down?
>
I've got a resource that loads a fairly large text file into a static
array when it is instantiated.  It takes several seconds (on my weak
machine) to load.  The first time I run my resource app after starting the
server, it takes (again on a weak machine that badly needs upgrading)
about 20 seconds.  Each run thereafter completes in 1-2 seconds.  This
tells me that (a)the file is only loaded once, and (b)the static array is
truly static as long as I don't restart the server.

A side effect of this is that it requires a server restart to implement
any change to your resource code.

> 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 ...
I don't know.

<sig>Higg.</sig>

Received on Sunday, 6 October 1996 22:13:56 UTC