Skip to content

Commit 94f861f

Browse files
committed
Revert "Improve logging, remove unnessary use of cast"
This reverts commit c92f53e.
1 parent c92f53e commit 94f861f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<groupId>ch.qos.logback</groupId>
8181
<artifactId>logback-classic</artifactId>
8282
<version>0.9.26</version>
83+
<scope>test</scope>
8384
</dependency>
8485
<dependency>
8586
<groupId>log4j</groupId>

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,8 @@ private <T> Future<T> doConnect(final Request request, final AsyncHandler<T> asy
765765
return f;
766766
}
767767

768+
log.debug("\n\nNon cached Request {}\n", request);
769+
768770
if (!connectionsPool.canCacheConnection() ||
769771
(config.getMaxTotalConnections() > -1 && (maxConnections.get() + 1) > config.getMaxTotalConnections())) {
770772
throw new IOException(String.format("Too many connections %s", config.getMaxTotalConnections()));
@@ -823,8 +825,6 @@ private <T> Future<T> doConnect(final Request request, final AsyncHandler<T> asy
823825
channelFuture.addListener(c);
824826
}
825827

826-
log.debug("\n\nNon cached Request {}\n using Channel {}", request, channelFuture.getChannel());
827-
828828
if (!c.future().isCancelled() || !c.future().isDone()) {
829829
openChannels.add(channelFuture.getChannel());
830830
c.future().attachChannel(channelFuture.getChannel(), false);
@@ -1252,7 +1252,7 @@ private void abort(NettyResponseFuture<?> future, Throwable t) {
12521252
openChannels.remove(future.channel());
12531253
}
12541254

1255-
log.debug("aborting Future {}\n", future);
1255+
log.debug("aborting Future {}", future);
12561256
log.debug(t.getMessage(), t);
12571257

12581258
future.abort(t);
@@ -1293,7 +1293,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
12931293
exception = ex;
12941294
}
12951295

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

12981298
if (ctx.getAttachment() instanceof AsyncCallable) {
12991299
AsyncCallable ac = (AsyncCallable) ctx.getAttachment();
@@ -1334,13 +1334,15 @@ protected boolean remotelyClosed(Channel channel, NettyResponseFuture<?> future)
13341334

13351335
connectionsPool.removeAll(channel);
13361336

1337-
if (future == null) {
1337+
if (future == null && channel.getPipeline().getContext(NettyAsyncHttpProvider.class).getAttachment() != null
1338+
&& NettyResponseFuture.class.isAssignableFrom(
1339+
channel.getPipeline().getContext(NettyAsyncHttpProvider.class).getAttachment().getClass())) {
13381340
future = (NettyResponseFuture<?>)
13391341
channel.getPipeline().getContext(NettyAsyncHttpProvider.class).getAttachment();
13401342
}
13411343

13421344
if (future == null || future.cannotBeReplay()) {
1343-
log.debug("Unable to replay request {}\n associated with future {}", future == null ? "null" : future.getNettyRequest(), future);
1345+
log.debug("Unable to replay request {} associated with future", future == null ? "" : future.getNettyRequest(), future);
13441346
return false;
13451347
}
13461348

@@ -1451,7 +1453,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
14511453
}
14521454

14531455
if (abortOnReadCloseException(cause) || abortOnWriteCloseException(cause)) {
1454-
log.debug("Trying to recover request {}\n from dead Channel: {}\n", channel);
1456+
log.debug("Trying to recover from dead Channel: {}", channel);
14551457
if (remotelyClosed(channel, future)) {
14561458
return;
14571459
}
@@ -1722,7 +1724,7 @@ public synchronized void run() {
17221724
}
17231725

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

17271729
int requestTimeout = config.getRequestTimeoutInMs();
17281730
PerRequestConfig p = this.nettyResponseFuture.getRequest().getPerRequestConfig();

0 commit comments

Comments
 (0)