sgroschupf/zkclient

how to close zk connection from a listener?

Opened this issue · 1 comments

image
image
As shown in the above figure, I tried to close the connection in the listener function when it is in a Disconnected state. However, calling the close() method throws an InterruptedException. The code that throws the exception is as follows.
image
When an exception is thrown, the function returns directly, preventing it from reaching the subsequent close method and causing it to fail to close. Additionally, it is not possible to catch this exception externally because the zkClient internally has a thread that catches the exception.
so, how can I do to close it in the listener function?
please, help me. thanks

by the way, I just want to close the connection when the zk server cant access, to ensure normal business processing.