users@glassfish.java.net

What is the life-cycle of a ServerAuthModule on GF

From: <glassfish_at_javadesktop.org>
Date: Tue, 25 Mar 2008 13:24:48 PST

I have built a ServerAuthModule (SAM) for HTTPServletMode which is working in GF but the server seems to create new instances of the class on every call. (Note: I am testing on localhost and it might be that I am getting a new session on each call). So here is the question.

What is the normal life-cycle for a ServerAuthModule. I see a few possibilites.

1) The SAM's lifetime is tied to the lifetime of server. The server boots up, has a web app that is linked to the SAM, so it starts up the SAM class and keeps it in memory until the server stops

2) The SAM's lifetime is tied to the session. When a new session starts, the server starts up a SAM for that session.

3) The SAM's lifetime is tied to an HTTP request - Each new request means a new SAM.

I want my SAM to process as fast as possible so I am considering using a DB connection pool inside the SAM and a least-recently-used in-memory cache of user and groups to minimize DB lookups (Our app users tend to have stable security profiles)

Also, is it possible for the SAM to use a JDBC connection pool that is configured on the server or do I need to roll my own internal connection pool

Thanks
Dave
[Message sent by forum member 'davebolt' (davebolt)]

http://forums.java.net/jive/thread.jspa?messageID=265804