Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit178ca7f

Browse files
committed
Add some dev comments
1 parent6c4712b commit178ca7f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/main/java/com/ning/http/client/providers/netty/NettyAsyncHttpProvider.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,17 @@ protected final <T> void writeRequest(final Channel channel,
315315
finalNettyResponseFuture<T>future,
316316
finalHttpRequestnettyRequest) {
317317
try {
318+
/**
319+
* If the channel is dead because it was pooled and the remote server decided to close it,
320+
* we need to try to recover in order to prevent failing a valid request.
321+
*/
318322
if (!channel.isOpen() || !channel.isConnected()) {
319323
if (!remotelyClosed(channel,future)) {
320324
abort(future,newConnectException());
321-
return;
322325
}else {
323326
log.debug("Request {} has been recovered",nettyRequest);
324-
return;
325327
}
328+
return;
326329
}
327330

328331
Bodybody =null;
@@ -344,7 +347,6 @@ protected final <T> void writeRequest(final Channel channel,
344347
}
345348
}
346349

347-
348350
if (TransferCompletionHandler.class.isAssignableFrom(future.getAsyncHandler().getClass())) {
349351

350352
FluentCaseInsensitiveStringsMaph =newFluentCaseInsensitiveStringsMap();
@@ -1629,6 +1631,10 @@ public void operationComplete(ChannelFuture cf) {
16291631
}
16301632
future.touch();
16311633

1634+
/**
1635+
* We need to make sure we aren't in the middle of an authorization process before publishing events
1636+
* as we will re-publish again the same event after the authorization, causing unpredictable behavior.
1637+
*/
16321638
Realmrealm =future.getRequest().getRealm() !=null ?future.getRequest().getRealm() :NettyAsyncHttpProvider.this.getConfig().getRealm();
16331639
booleanstartPublishing =future.isInAuth()
16341640
||realm ==null

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp