This question is more servlet-interest oriented than JBoss oriented. You
might want to check out that mailing list.
(http://archives.java.sun.com/archives/servlet-interest.html)

The typical way I have handled this in the past is to put the userId (if not
the entire User*) into the HTTPSession when it's known. If there's a userId
in the session, the user is logged in. Database calls are not necessary (for
this). This has the beneficial side effect of automatically "logging out"
the user when their session expires.


*Putting the User object into the HTTP session will affect scalability if
the User object is:
  - very large
  - tied to many other objects
  - is being passed back to the client (Web browser) by the application
server.

(I have recently read on a mailing list -- this one? -- that some
application servers send the HTTPSession's contents back to the client --
somehow -- to keep from managing session state. This sounds ridiculous to
me, but I haven't checked the spec to see if it is valid. Even if it is, I
do not know for which app servers it is true. For any where it is, you
definitely don't want to put the User object into the session.)


~Mike

----- Original Message -----
From: "Tim Yates" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 30, 2001 10:45 AM
Subject: [JBoss-user] Design Question...


> Hi there!!
>
> When a user hits the site, they get allocated a unique 48 character
session
> ID (allocated by me).  If they then login, I tie that sessionId to a
userId
> (both rows in seperate tables)
>
> But I have a design question...  They can log-out, but many do not
> (obviously), so what would be the best way of clearing out-of-date
> sessionIds at regular intervals?
>
> As far as I can see, I have two choices...
>
> 1) A seperate java server which runs through the instance table every hour
> or so, and calls my EJB's to delete those rows that have become inactive
>
> or 2) Use a Timer MBean to callback after a certain time to remove the
> row...
>
> I am thinking that option 2 would be a much cleaner way of doing things,
but
> what would be the way to do it?
>
> Sorry if I am talking rubbish, I have been searching for tutorials, and
> books all afternoon, and the Web (and Amazon) has come up dry :(
>
> Thanks for any input you can give :)
>
> Tim Yates



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to