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

Commitf4768d0

Browse files
committed
Improve logging flow when replaying request. No functional change
1 parent94f861f commitf4768d0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private Channel lookupInCache(URI uri) {
276276
finalChannelchannel =connectionsPool.poll(AsyncHttpProviderUtils.getBaseUrl(uri));
277277

278278
if (channel !=null) {
279-
log.debug("Using cached Channel {} for uri {}",channel,uri);
279+
log.debug("Using cached Channel {}\n for uri {}\n",channel,uri);
280280

281281
try {
282282
// Always make sure the channel who got cached support the proper protocol. It could
@@ -748,7 +748,7 @@ private <T> Future<T> doConnect(final Request request, final AsyncHandler<T> asy
748748
f.setState(NettyResponseFuture.STATE.POOLED);
749749
f.attachChannel(channel,false);
750750

751-
log.debug("\n\nCached Request{}\n",channel);
751+
log.debug("\nUsing cached Channel {}\n for request{}\n",channel,request);
752752
channel.getPipeline().getContext(NettyAsyncHttpProvider.class).setAttachment(f);
753753

754754
try {
@@ -765,8 +765,6 @@ private <T> Future<T> doConnect(final Request request, final AsyncHandler<T> asy
765765
returnf;
766766
}
767767

768-
log.debug("\n\nNon cached Request {}\n",request);
769-
770768
if (!connectionsPool.canCacheConnection() ||
771769
(config.getMaxTotalConnections() > -1 && (maxConnections.get() +1) >config.getMaxTotalConnections())) {
772770
thrownewIOException(String.format("Too many connections %s",config.getMaxTotalConnections()));
@@ -825,6 +823,8 @@ private <T> Future<T> doConnect(final Request request, final AsyncHandler<T> asy
825823
channelFuture.addListener(c);
826824
}
827825

826+
log.debug("\n\nNon cached Request {}\n with channel {}\n",request,channel);
827+
828828
if (!c.future().isCancelled() || !c.future().isDone()) {
829829
openChannels.add(channelFuture.getChannel());
830830
c.future().attachChannel(channelFuture.getChannel(),false);
@@ -1293,7 +1293,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
12931293
exception =ex;
12941294
}
12951295

1296-
log.debug("Channel Closed: {}",e.getChannel());
1296+
log.debug("Channel Closed: {} with attachment {}",e.getChannel(),ctx.getAttachment());
12971297

12981298
if (ctx.getAttachment()instanceofAsyncCallable) {
12991299
AsyncCallableac = (AsyncCallable)ctx.getAttachment();
@@ -1342,21 +1342,21 @@ protected boolean remotelyClosed(Channel channel, NettyResponseFuture<?> future)
13421342
}
13431343

13441344
if (future ==null ||future.cannotBeReplay()) {
1345-
log.debug("Unable to replay request {} associated with future",future ==null ?"" :future.getNettyRequest(),future);
1345+
log.debug("Unable to replay request {}\n associated with future {}\n",future ==null ?"null" :future.getNettyRequest(),future);
13461346
returnfalse;
13471347
}
13481348

13491349
future.setState(NettyResponseFuture.STATE.RECONNECTED);
13501350

1351-
log.debug("Trying to recover request {}",future.getNettyRequest());
1351+
log.debug("Trying to recover request {}\n",future.getNettyRequest());
13521352

13531353
try {
13541354
nextRequest(future.getRequest(),future);
13551355
returntrue;
13561356
}catch (IOExceptioniox) {
13571357
future.setState(NettyResponseFuture.STATE.CLOSED);
13581358
future.abort(iox);
1359-
log.error("Remotely Closed",iox);
1359+
log.error("Remotely Closed, unable to recover",iox);
13601360
}
13611361
returnfalse;
13621362
}
@@ -1453,7 +1453,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
14531453
}
14541454

14551455
if (abortOnReadCloseException(cause) ||abortOnWriteCloseException(cause)) {
1456-
log.debug("Trying to recover from dead Channel: {}",channel);
1456+
log.debug("Trying to recover from dead Channel: {}\n request {}",channel,future.getNettyRequest());
14571457
if (remotelyClosed(channel,future)) {
14581458
return;
14591459
}
@@ -1724,7 +1724,7 @@ public synchronized void run() {
17241724
}
17251725

17261726
if (this.nettyResponseFuture !=null &&this.nettyResponseFuture.hasExpired()) {
1727-
log.debug("Request Timeout expired for {}",this.nettyResponseFuture);
1727+
log.debug("Request Timeout expired for {}\n",this.nettyResponseFuture);
17281728

17291729
intrequestTimeout =config.getRequestTimeoutInMs();
17301730
PerRequestConfigp =this.nettyResponseFuture.getRequest().getPerRequestConfig();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp