是否可以断开QuickFixJ中的Acceptor会话?我已经尝试了方法'disconnect(String reason,boolean logError)'。但是,一旦对方尝试重新连接,则会话将重新连接。我想要的是保持断开连接。
根据disconnect()
方法的javadoc注释,您不应该从用户代码中调用它:
* 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.
因此,请使用logout()
方法从会话注销。它还将禁用会话,以使对方在连接时注销。但是登录的时间可能很短。这是因为该标志仅每秒检查一次。
要立即拒绝登录,您可以从RejectLogon
回调中抛出fromAdmin()
异常。