Warm tip: This article is reproduced from stackoverflow.com, please click
quickfix quickfixj

How to permanently disconnect an Acceptor session

发布于 2020-06-15 09:23:56

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.

Questioner
Muhammadh Aadhil
Viewed
24
Christoph John 2020-03-30 18:06

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.