users@glassfish.java.net

User logs out, fires event

From: <glassfish_at_javadesktop.org>
Date: Sat, 26 Apr 2008 14:08:21 PDT

Hi,

Imagine there is a web-app up and running on Glassfish. There are perhaps five users logged in and using the app. How is it possible to call a class method (fire an event?) when any user logs off, passing to that method the user's ID?

The reason I ask: The users will be accessing and modifying DB records. When the user "checks out" the record a lock is placed on it denying other users to view or modify. Naturally I have provided the user the ability to "check in" the record but in order to stop records remaining locked if the user forgets to check it in I need a way to automatically do so, hence when they log off I would like the server to automatically check to see if they have current locks in place and if so to remove them.

By the way, the "lock" is simply a field in the DB row set to "LOCKED". I am specificaly not using any in-built DB locking facility.

Any help, as ever, much appreciated.
Cheers
Hugh
[Message sent by forum member 'hughacland' (hughacland)]

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