File tree Expand file tree Collapse file tree
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/bootstrap
httpcore5/src/main/java/org/apache/hc/core5/reactor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 */
2727package org .apache .hc .core5 .http2 .impl .nio .bootstrap ;
2828
29- import java .nio .channels .CancelledKeyException ;
3029import java .util .concurrent .atomic .AtomicBoolean ;
3130import java .util .concurrent .atomic .AtomicReference ;
3231
@@ -49,11 +48,7 @@ public void setDependency(final Cancellable cancellable) {
4948 if (cancelled .get ()) {
5049 final Cancellable dependency = dependencyRef .getAndSet (null );
5150 if (dependency != null ) {
52- try {
53- dependency .cancel ();
54- } catch (final CancelledKeyException ignore ) {
55- // Session already gone; cancellation is effectively complete.
56- }
51+ dependency .cancel ();
5752 }
5853 }
5954 }
@@ -68,11 +63,7 @@ public boolean cancel() {
6863 if (cancelled .compareAndSet (false , true )) {
6964 final Cancellable dependency = dependencyRef .getAndSet (null );
7065 if (dependency != null ) {
71- try {
72- dependency .cancel ();
73- } catch (final CancelledKeyException ignore ) {
74- // Session already gone; treat as successfully cancelled.
75- }
66+ dependency .cancel ();
7667 }
7768 return true ;
7869 }
Original file line number Diff line number Diff line change 3232import java .net .StandardSocketOptions ;
3333import java .nio .ByteBuffer ;
3434import java .nio .channels .ByteChannel ;
35+ import java .nio .channels .CancelledKeyException ;
3536import java .nio .channels .SelectionKey ;
3637import java .nio .channels .SocketChannel ;
3738import java .util .Deque ;
@@ -158,7 +159,11 @@ public SocketAddress getRemoteAddress() {
158159
159160 @ Override
160161 public int getEventMask () {
161- return this .key .interestOps ();
162+ try {
163+ return this .key .interestOps ();
164+ } catch (final CancelledKeyException ignore ) {
165+ return 0 ;
166+ }
162167 }
163168
164169 @ Override
You can’t perform that action at this time.
0 commit comments