mrcjkb commented on code in PR #3010: URL: https://github.com/apache/thrift/pull/3010#discussion_r1691109113
########## lib/java/src/main/java/org/apache/thrift/server/AbstractNonblockingServer.java: ########## @@ -518,9 +522,11 @@ private boolean internalRead() { /** We're done writing, so reset our interest ops and change state accordingly. */ private void prepareRead() { - // we can set our interest directly without using the queue because - // we're in the select thread. - selectionKey_.interestOps(SelectionKey.OP_READ); + if (selectionKey_.isValid()) { + // we can set our interest directly without using the queue because + // we're in the select thread. + selectionKey_.interestOps(SelectionKey.OP_READ); + } // get ready for another go-around buffer_ = ByteBuffer.allocate(4); state_ = FrameBufferState.READING_FRAME_SIZE; Review Comment: Not sure if the rest of `prepareRead` should go in the conditional block :thinking: -- 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. To unsubscribe, e-mail: notifications-unsubscr...@thrift.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org