Well, I don’t love this solution, but CommandSession#execute checks the session 
status so I can use the following, which throws an IllegalStateException 
if/when the CommandSession is closed.

session.execute("");

This works for us because our solution is low volume and used just for 
diagnostic purposes. It may be worth exposing the CommandSession’s connection 
state at some point in the future.


From: Bree Van Oss <bree.van...@myfuelmaster.com.INVALID>
Date: Tuesday, January 3, 2023 at 8:30 PM
To: felix users <users@felix.apache.org>
Subject: CommandSession is closed?
CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


Hello!

Is there a way to tell whether a given CommandSession is closed? I see that 
CommandSessionImpl has a closed flag, but that doesn’t appear to be exposed via 
the API. We use a subscription approach via Gogo that allows activity occurring 
in a different thread to be written to the subscribing CommandSession. This all 
works fine, but I haven’t found a way to clean up subscriptions based on the 
status of the given CommandSession. When I write to a closed CommandSession no 
exceptions are thrown.

Any suggestions are appreciated.

Thanks!
Bree

Reply via email to