• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Detect Client Shutdown

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I am an EJB/JBoss newbie trying to develop a server app with multiple clients. The client app (launched with WebStart) uses both jms and rmi to communicate with the server app. All of my ejbs are stateless. I only want to allow a client to be logged in, er, 'once at a time.' In other words, if a client is logged on one machine, that client should not be able to log in elsewhere. So when a client logs in, I set a boolean in the db and the client cannot log in elsewhere until that boolean changes.

My question is: what is the best way to detect client connection failure? For example, the client's power fails, or the client's internet connection dies? Is there a built-in way to listen for such disconnects in JBoss, or do I need to set up my own periodic ping from the server app to ensure client's are still 'alive?'

Thanks,

Josh
 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you should use a Stateful session bean to manage that, then implement a listener to the session timeout of the bean and/or in the preDestroyed method to remove the flag. So if user is disconnected unexpectedly, then longest time they have to wait is the session timeout.
 
get schwifty. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic