File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
src/main/java/com/ning/http/client/providers/netty Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ void setAsyncHandler(AsyncHandler<V> asyncHandler) {
163
163
public boolean cancel (boolean force ) {
164
164
cancelTimeouts ();
165
165
166
- if (isCancelled .get ( ))
166
+ if (isCancelled .getAndSet ( true ))
167
167
return false ;
168
168
169
169
try {
@@ -180,7 +180,6 @@ public boolean cancel(boolean force) {
180
180
}
181
181
}
182
182
latch .countDown ();
183
- isCancelled .set (true );
184
183
runListeners ();
185
184
return true ;
186
185
}
@@ -335,17 +334,16 @@ public final void done() {
335
334
public final void abort (final Throwable t ) {
336
335
cancelTimeouts ();
337
336
338
- if (isDone .get () || isCancelled .get ( ))
337
+ if (isDone .get () || isCancelled .getAndSet ( true ))
339
338
return ;
340
339
340
+ isCancelled .set (true );
341
341
exEx .compareAndSet (null , new ExecutionException (t ));
342
342
if (onThrowableCalled .compareAndSet (false , true )) {
343
343
try {
344
344
asyncHandler .onThrowable (t );
345
345
} catch (Throwable te ) {
346
346
logger .debug ("asyncHandler.onThrowable" , te );
347
- } finally {
348
- isCancelled .set (true );
349
347
}
350
348
}
351
349
latch .countDown ();
You can’t perform that action at this time.
0 commit comments