Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Is there a pattern to know when a client disconnects?

Hi all, My use case is that  I need to  cancel a long running  database execution if the client disconnects. 

Setting setMaxInactiveInterval in combination with   a HttpSessionListener  sessionDestroyed event  seems promising but the events only generate   on the next  attempt to connect with the expired session.   I could probably implement a thread which periodically checked every session but I'm wondering if there are any common patterns for this use case.   I see AsyncContext raised as an option but the listeners on the  AsyncContext    do not detect  if a client disconnects and leave me in the same place as using a HttpSessionListener. 

Thanks for your help!

Back to the top