Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

APIs or patterns for listing authenticated users.  RSS feed

Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm looking for some feedback on a working solution I've implemented that feels a bit clunky.

The basic requirement was to remove stale entries from a simple locking mechanisim if the user had logged off or timed out.

My solution (after a few suggestions from the websphere usenet group) was to implement a session binding listener and add one of these objects to each users session as they log in. (I use a global filter to test each request to ensure the users session contains a listener.)

The listener class has a static hashmap that stores a list of all logged on users. As bind and unbind events are fired the relevant user is added or removed from the list. A public method returns the current 'active' user list which we use to verify our lock entries.

Has anyone else tackled this kind of problem before?


Dave Patterson.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!