Skip to content

Commit 594a26f

Browse files
author
Stephane Landelle
committed
minor clean up
1 parent e8a1ea1 commit 594a26f

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

api/src/main/java/org/asynchttpclient/util/AsyncHttpProviderUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
public class AsyncHttpProviderUtils {
3232

3333
public static final IOException REMOTELY_CLOSED_EXCEPTION = new IOException("Remotely closed");
34-
34+
public static final IOException CHANNEL_CLOSED_EXCEPTION = new IOException("Channel closed");
3535
static {
36-
REMOTELY_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[] {});
36+
REMOTELY_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[0]);
37+
CHANNEL_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[0]);
3738
}
3839

3940
private final static byte[] NO_BYTES = new byte[0];

providers/netty3/src/main/java/org/asynchttpclient/providers/netty3/handler/Processor.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ public class Processor extends SimpleChannelUpstreamHandler {
4040

4141
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class);
4242

43-
public static final IOException CHANNEL_CLOSED_EXCEPTION = new IOException("Channel closed");
44-
static {
45-
CHANNEL_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[0]);
46-
}
47-
4843
private final AsyncHttpClientConfig config;
4944
private final ChannelManager channelManager;
5045
private final NettyRequestSender requestSender;
@@ -123,7 +118,7 @@ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws
123118
future.touch();
124119

125120
if (!config.getIOExceptionFilters().isEmpty()
126-
&& requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
121+
&& requestSender.applyIoExceptionFiltersAndReplayRequest(future, AsyncHttpProviderUtils.CHANNEL_CLOSED_EXCEPTION, channel))
127122
return;
128123

129124
protocol.onClose(future);
@@ -159,7 +154,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws
159154

160155
// FIXME why drop the original exception and throw a new one?
161156
if (!config.getIOExceptionFilters().isEmpty()) {
162-
if (!requestSender.applyIoExceptionFiltersAndReplayRequest(future, CHANNEL_CLOSED_EXCEPTION, channel))
157+
if (!requestSender.applyIoExceptionFiltersAndReplayRequest(future, AsyncHttpProviderUtils.CHANNEL_CLOSED_EXCEPTION, channel))
163158
// Close the channel so the recovering can occurs.
164159
Channels.silentlyCloseChannel(channel);
165160
return;

providers/netty4/src/main/java/org/asynchttpclient/providers/netty4/handler/Processor.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
*/
1414
package org.asynchttpclient.providers.netty4.handler;
1515

16-
import static org.asynchttpclient.util.AsyncHttpProviderUtils.REMOTELY_CLOSED_EXCEPTION;
16+
import static org.asynchttpclient.util.AsyncHttpProviderUtils.*;
17+
1718
import io.netty.channel.Channel;
1819
import io.netty.channel.ChannelHandler.Sharable;
1920
import io.netty.channel.ChannelHandlerContext;
@@ -40,11 +41,6 @@ public class Processor extends ChannelInboundHandlerAdapter {
4041

4142
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class);
4243

43-
public static final IOException CHANNEL_CLOSED_EXCEPTION = new IOException("Channel Closed");
44-
static {
45-
CHANNEL_CLOSED_EXCEPTION.setStackTrace(new StackTraceElement[0]);
46-
}
47-
4844
private final AsyncHttpClientConfig config;
4945
private final ChannelManager channelManager;
5046
private final NettyRequestSender requestSender;

0 commit comments

Comments
 (0)