Reputation: 53
Is it possible to disconnect an Acceptor session in QuickFIX/J ? I have tried the method disconnect(String reason, boolean logError)
. But once the counterparty tried to reconnect then the session is reconnected.
What i want is to stay disconnected.
Upvotes: 0
Views: 506
Reputation: 3283
According to the javadoc comment for the disconnect()
method you should rather not call it from user code:
* This method should not be called from user-code since it is likely
* to deadlock when called from a different thread than the Session thread
* and messages are sent/received concurrently.
* Instead the logout() method should be used where possible.
So please use the logout()
method to log out from a Session. It will also disable the Session in a way that counterparties will be logged out when connecting. But there can be a short timeframe when they will be logged on. This is because that flag is only checked once a second.
To reject a Logon right away, you could throw a RejectLogon
Exception out of your fromAdmin()
callback.
Update: Starting from QuickFIX/J 2.3.0 the Acceptor session will stay disconnected after calling logout()
. See https://github.com/quickfix-j/quickfixj/pull/360
Upvotes: 1