0 Replies Latest reply on Dec 10, 2006 2:21 PM by Karstem Strunk

    Timers in stateful session bean?

    Karstem Strunk Newbie


      I'm writing a polling html chat for my web project. After login a contact list is display to the user which shows which users are also online. This list is refreshed using Ajax every x seconds. For that the users online state is stored in database using an entity bean.

      But how to keep the users online state up-to-date? When a user logs out normally he will be set to offline. But what should I do if the user just closes his browser? Is there a way to get an event if a user has not refreshed his buddy list for a long time (> 2x seconds)? For me this looks like a timer which is reset every time the user refreshed his contact list? But as far as I know timers aren't allowed in stateful session bean, are they? Or does anyone has a better idea how to handle this approch?

      I'm using EJB3 with JBoss 4.0.5

      Best regards,