可以catch这个Exception synchronized(call.connection.responseQueue) { if (processResponse(call.connection.responseQueue, false)) { try { key.interestOps(0); } catch (CancelledKeyException e) { /* The Listener/reader might have closed the socket. * We don't explicitly cancel the key, so not sure if this will * ever fire. * This warning could be removed. */ LOG.warn("Exception while changing ops : " + e); } } }
使用java nio 时报 java.nio.channels.CancelledKeyException
最新推荐文章于 2024-06-22 16:00:38 发布