Skip to content

Commit d44ca8c

Browse files
committed
Rename Processor into AsyncHttpClientHandler
1 parent 8a0bfd4 commit d44ca8c

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import org.asynchttpclient.netty.channel.pool.DefaultChannelPool;
5959
import org.asynchttpclient.netty.channel.pool.NoopChannelPool;
6060
import org.asynchttpclient.netty.handler.HttpProtocol;
61-
import org.asynchttpclient.netty.handler.Processor;
61+
import org.asynchttpclient.netty.handler.AsyncHttpClientHandler;
6262
import org.asynchttpclient.netty.handler.WebSocketProtocol;
6363
import org.asynchttpclient.netty.request.NettyRequestSender;
6464
import org.asynchttpclient.netty.ssl.DefaultSslEngineFactory;
@@ -70,16 +70,16 @@
7070
public class ChannelManager {
7171

7272
private static final Logger LOGGER = LoggerFactory.getLogger(ChannelManager.class);
73-
public static final String HTTP_HANDLER = "httpHandler";
74-
public static final String SSL_HANDLER = "sslHandler";
75-
public static final String HTTP_PROCESSOR = "httpProcessor";
76-
public static final String WS_PROCESSOR = "wsProcessor";
73+
public static final String HTTP_CLIENT_CODEC = "http";
74+
public static final String SSL_HANDLER = "ssl";
7775
public static final String DEFLATER_HANDLER = "deflater";
7876
public static final String INFLATER_HANDLER = "inflater";
79-
public static final String CHUNKED_WRITER_HANDLER = "chunkedWriter";
77+
public static final String CHUNKED_WRITER_HANDLER = "chunked-writer";
8078
public static final String WS_DECODER_HANDLER = "ws-decoder";
8179
public static final String WS_FRAME_AGGREGATOR = "ws-aggregator";
8280
public static final String WS_ENCODER_HANDLER = "ws-encoder";
81+
public static final String AHC_HTTP_HANDLER = "ahc-http";
82+
public static final String AHC_WS_HANDLER = "ahc-ws";
8383

8484
private final AsyncHttpClientConfig config;
8585
private final SslEngineFactory sslEngineFactory;
@@ -102,7 +102,7 @@ public class ChannelManager {
102102
private final ConcurrentHashMapV8<Channel, Object> channelId2PartitionKey;
103103
private final ConcurrentHashMapV8.Fun<Object, Semaphore> semaphoreComputer;
104104

105-
private Processor wsProcessor;
105+
private AsyncHttpClientHandler wsHandler;
106106

107107
public ChannelManager(final AsyncHttpClientConfig config, Timer nettyTimer) {
108108

@@ -237,19 +237,19 @@ private Class<? extends Channel> getEpollSocketChannelClass() {
237237
public void configureBootstraps(NettyRequestSender requestSender) {
238238

239239
HttpProtocol httpProtocol = new HttpProtocol(this, config, requestSender);
240-
final Processor httpProcessor = new Processor(config, this, requestSender, httpProtocol);
240+
final AsyncHttpClientHandler httpHandler = new AsyncHttpClientHandler(config, this, requestSender, httpProtocol);
241241

242242
WebSocketProtocol wsProtocol = new WebSocketProtocol(this, config, requestSender);
243-
wsProcessor = new Processor(config, this, requestSender, wsProtocol);
243+
wsHandler = new AsyncHttpClientHandler(config, this, requestSender, wsProtocol);
244244

245245
httpBootstrap.handler(new ChannelInitializer<Channel>() {
246246
@Override
247247
protected void initChannel(Channel ch) throws Exception {
248248
ch.pipeline()//
249-
.addLast(HTTP_HANDLER, newHttpClientCodec())//
249+
.addLast(HTTP_CLIENT_CODEC, newHttpClientCodec())//
250250
.addLast(INFLATER_HANDLER, newHttpContentDecompressor())//
251251
.addLast(CHUNKED_WRITER_HANDLER, new ChunkedWriteHandler())//
252-
.addLast(HTTP_PROCESSOR, httpProcessor);
252+
.addLast(AHC_HTTP_HANDLER, httpHandler);
253253

254254
ch.config().setOption(ChannelOption.AUTO_READ, false);
255255

@@ -262,8 +262,8 @@ protected void initChannel(Channel ch) throws Exception {
262262
@Override
263263
protected void initChannel(Channel ch) throws Exception {
264264
ch.pipeline()//
265-
.addLast(HTTP_HANDLER, newHttpClientCodec())//
266-
.addLast(WS_PROCESSOR, wsProcessor);
265+
.addLast(HTTP_CLIENT_CODEC, newHttpClientCodec())//
266+
.addLast(AHC_WS_HANDLER, wsHandler);
267267

268268
if (config.getWsAdditionalPipelineInitializer() != null)
269269
config.getWsAdditionalPipelineInitializer().initPipeline(ch.pipeline());
@@ -405,23 +405,23 @@ public static boolean isSslHandlerConfigured(ChannelPipeline pipeline) {
405405
}
406406

407407
public void upgradeProtocol(ChannelPipeline pipeline, Uri requestUri) throws SSLException {
408-
if (pipeline.get(HTTP_HANDLER) != null)
409-
pipeline.remove(HTTP_HANDLER);
408+
if (pipeline.get(HTTP_CLIENT_CODEC) != null)
409+
pipeline.remove(HTTP_CLIENT_CODEC);
410410

411411
if (requestUri.isSecured())
412412
if (isSslHandlerConfigured(pipeline)) {
413-
pipeline.addAfter(SSL_HANDLER, HTTP_HANDLER, newHttpClientCodec());
413+
pipeline.addAfter(SSL_HANDLER, HTTP_CLIENT_CODEC, newHttpClientCodec());
414414
} else {
415-
pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec());
415+
pipeline.addFirst(HTTP_CLIENT_CODEC, newHttpClientCodec());
416416
pipeline.addFirst(SSL_HANDLER, createSslHandler(requestUri.getHost(), requestUri.getExplicitPort()));
417417
}
418418

419419
else
420-
pipeline.addFirst(HTTP_HANDLER, newHttpClientCodec());
420+
pipeline.addFirst(HTTP_CLIENT_CODEC, newHttpClientCodec());
421421

422422
if (requestUri.isWebSocket()) {
423-
pipeline.addAfter(HTTP_PROCESSOR, WS_PROCESSOR, wsProcessor);
424-
pipeline.remove(HTTP_PROCESSOR);
423+
pipeline.addAfter(AHC_HTTP_HANDLER, AHC_WS_HANDLER, wsHandler);
424+
pipeline.remove(AHC_HTTP_HANDLER);
425425
}
426426
}
427427

@@ -477,9 +477,9 @@ public Bootstrap getBootstrap(Uri uri, ProxyServer proxy) {
477477
}
478478

479479
public void upgradePipelineForWebSockets(ChannelPipeline pipeline) {
480-
pipeline.addAfter(HTTP_HANDLER, WS_ENCODER_HANDLER, new WebSocket08FrameEncoder(true));
481-
pipeline.remove(HTTP_HANDLER);
482-
pipeline.addBefore(WS_PROCESSOR, WS_DECODER_HANDLER, new WebSocket08FrameDecoder(false, false, config.getWebSocketMaxFrameSize()));
480+
pipeline.addAfter(HTTP_CLIENT_CODEC, WS_ENCODER_HANDLER, new WebSocket08FrameEncoder(true));
481+
pipeline.remove(HTTP_CLIENT_CODEC);
482+
pipeline.addBefore(AHC_WS_HANDLER, WS_DECODER_HANDLER, new WebSocket08FrameDecoder(false, false, config.getWebSocketMaxFrameSize()));
483483
pipeline.addAfter(WS_DECODER_HANDLER, WS_FRAME_AGGREGATOR, new WebSocketFrameAggregator(config.getWebSocketMaxBufferSize()));
484484
}
485485

client/src/main/java/org/asynchttpclient/netty/handler/Processor.java renamed to client/src/main/java/org/asynchttpclient/netty/handler/AsyncHttpClientHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@
4040
import org.slf4j.LoggerFactory;
4141

4242
@Sharable
43-
public class Processor extends ChannelInboundHandlerAdapter {
43+
public class AsyncHttpClientHandler extends ChannelInboundHandlerAdapter {
4444

45-
private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class);
45+
private static final Logger LOGGER = LoggerFactory.getLogger(AsyncHttpClientHandler.class);
4646

4747
private final AsyncHttpClientConfig config;
4848
private final ChannelManager channelManager;
4949
private final NettyRequestSender requestSender;
5050
private final Protocol protocol;
5151

52-
public Processor(AsyncHttpClientConfig config,//
52+
public AsyncHttpClientHandler(AsyncHttpClientConfig config,//
5353
ChannelManager channelManager,//
5454
NettyRequestSender requestSender,//
5555
Protocol protocol) {

0 commit comments

Comments
 (0)