Resource Lookup

Christoph Begall writes:
 > Hi Jigsaw'ers,
 >   I just want to make sure that I got everything right:
 > When I make Jigsaw Resources, I would like to have a references to
 > other Resources. Now I have strange behaviour when I leave the server
 > alone - doing the things he wants to do - for a while and then waking
 > it up again, making HTTP-GET on my Resource. Now in the get() method
 > I want to use my reference to the other resource, to make things as
 > fast as they can be.
 > 1. Can this kind of programming course trouble and if so what kind of
 > trouble ? (I thought that there as long as I have the Java-Object I
 > also have the Resource in memory)

In general, keeping pointers to a resource *requires* that you
implement the ResourceLocker interface. The generic resource editor
does it (it keeps in a hastable a cache of resources that have been
edited until now), you mway want to check how it does it:

w3c.jigsaw.formedit.FormResourceEditor::notifyResourceLockBreak

 > 2. Would this be the right way: Always lookup a Resource and never use
 > a reference to the resource that I got from an earlier lookup

Thats' one way, slightly less efficient than managing a cache, but way
more simple. I would recommed this approach (there is also a cache
that is managed for you when using that way, in fact)

 > 3. Could this kind of program course
 > java.net.SocketException: Too many open files
 > (I dont think so, but what could lead to such an Exception) ?

No:
- make sure you always close the files you use
- 64 files (default on solaris) is not much, you may want to use
  ulimit to raise to at least 256 (you don't need to be superuser)
- they are known problems with at least CGI scripts (which I am about
  to fix)

Last but not least, if you really have a significant number of
simultaneous connections, then I guess I can't help ;-)

Anselm.

Received on Wednesday, 26 February 1997 07:06:29 UTC