eolivelli commented on a change in pull request #1235: ZOOKEEPER-3706:
ZooKeeper.close() would leak SendThread when the netw…
URL: https://github.com/apache/zookeeper/pull/1235#discussion_r385524199
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
##########
@@ -957,7 +962,11 @@ void readResponse(ByteBuffer incomingBuffer) throws
IOException {
SendThread(ClientCnxnSocket clientCnxnSocket) {
super(makeThreadName("-SendThread()"));
- state = States.CONNECTING;
+ try {
+ changeZkState(States.CONNECTING);
+ } catch (IOException e) {
+ throw new RuntimeException("Connection setup failed when
migrate state to CONNECTING");
Review comment:
Throwing a RuntimeException may lead to unexpected behaviour.
So we have a way to throw a checked exception and deal explicitly with this
case?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services