Created a SessionListener, that gets notified when ever a session gets ceated or destroyed.
When ever the user login in the Application, the session id is stored in the DB for that user .
1. When the user log's out Session is cleared (invalidated ) so the sessionListener gets notified So i'm Clearing the SessionId that is stored in the DB for that user.
The best you can do is keep a list of logged in users somewhere and clear the userids from this list when their sessions are closed (they log out) or time out (they're killed).