esensar/neovim-java

RPCClient should allow close and stop sender/listener

hkupty opened this issue · 2 comments

Hi,

I'm having issues with the Core-RPC API when I'm using default RPCClient.

Since I don't have control over the created resources, I can't stop the listener. This causes the process to hang when it should exit.

To circumvent that, I'll need to reimplement part of the solution on my end so I can use the executor and object mapper while I have control over both the socket and the listener simply to be able to exit cleanly.

A much simpler solution would be the RPCClient (or RPCStreamer) to expose a close/stop function that both stops the listener and closes the sender.

Cheers,
Henry John Kupty

Hi,

RPCConnection implements Closeable. Did you try closing it?
I thought that would be enough. Or is your issue that listener doesn't stop after that?

I can check this later and see if I have a solution for that, either adding close/stop or something else. You can open PR if you want.

Thanks for reporting this.

I can close the RPCConnection, that works.
The thing that is missing is stopping the RPCListener (BackgroundRPCListener). That is unreachable since it is encapsulated by the RPCClient/RPCStreamer.

A method for terminating the higher level thing closing both the connection and the listener would solve the trick.

I'll try to hack it and send a PR if I can.