Skip to content

Commit 6057965

Browse files
committed
Rename Callback into OnLastHttpContentCallback
1 parent 6e629e7 commit 6057965

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

client/src/main/java/org/asynchttpclient/netty/Callback.java renamed to client/src/main/java/org/asynchttpclient/netty/OnLastHttpContentCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
*/
1313
package org.asynchttpclient.netty;
1414

15-
public abstract class Callback {
15+
public abstract class OnLastHttpContentCallback {
1616

1717
protected final NettyResponseFuture<?> future;
1818

19-
public Callback(NettyResponseFuture<?> future) {
19+
public OnLastHttpContentCallback(NettyResponseFuture<?> future) {
2020
this.future = future;
2121
}
2222

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import org.asynchttpclient.exception.TooManyConnectionsException;
6060
import org.asynchttpclient.exception.TooManyConnectionsPerHostException;
6161
import org.asynchttpclient.handler.AsyncHandlerExtensions;
62-
import org.asynchttpclient.netty.Callback;
62+
import org.asynchttpclient.netty.OnLastHttpContentCallback;
6363
import org.asynchttpclient.netty.NettyResponseFuture;
6464
import org.asynchttpclient.netty.handler.AsyncHttpClientHandler;
6565
import org.asynchttpclient.netty.handler.HttpHandler;
@@ -465,9 +465,9 @@ public void upgradePipelineForWebSockets(ChannelPipeline pipeline) {
465465
pipeline.remove(HTTP_CLIENT_CODEC);
466466
}
467467

468-
public final Callback newDrainCallback(final NettyResponseFuture<?> future, final Channel channel, final boolean keepAlive, final Object partitionKey) {
468+
public final OnLastHttpContentCallback newDrainCallback(final NettyResponseFuture<?> future, final Channel channel, final boolean keepAlive, final Object partitionKey) {
469469

470-
return new Callback(future) {
470+
return new OnLastHttpContentCallback(future) {
471471
public void call() {
472472
tryToOfferChannelToPool(channel, future.getAsyncHandler(), keepAlive, partitionKey);
473473
}

client/src/main/java/org/asynchttpclient/netty/handler/AsyncHttpClientHandler.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.asynchttpclient.AsyncHttpClientConfig;
3030
import org.asynchttpclient.HttpResponseBodyPart;
3131
import org.asynchttpclient.exception.ChannelClosedException;
32-
import org.asynchttpclient.netty.Callback;
32+
import org.asynchttpclient.netty.OnLastHttpContentCallback;
3333
import org.asynchttpclient.netty.DiscardEvent;
3434
import org.asynchttpclient.netty.NettyResponseFuture;
3535
import org.asynchttpclient.netty.channel.ChannelManager;
@@ -67,8 +67,8 @@ public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exce
6767
Object attribute = Channels.getAttribute(channel);
6868

6969
try {
70-
if (attribute instanceof Callback && msg instanceof LastHttpContent) {
71-
((Callback) attribute).call();
70+
if (attribute instanceof OnLastHttpContentCallback && msg instanceof LastHttpContent) {
71+
((OnLastHttpContentCallback) attribute).call();
7272

7373
} else if (attribute instanceof NettyResponseFuture) {
7474
NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute;
@@ -127,8 +127,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
127127
// logic can kick-in
128128
attribute = ((StreamedResponsePublisher) attribute).future();
129129
}
130-
if (attribute instanceof Callback) {
131-
Callback callback = (Callback) attribute;
130+
if (attribute instanceof OnLastHttpContentCallback) {
131+
OnLastHttpContentCallback callback = (OnLastHttpContentCallback) attribute;
132132
Channels.setAttribute(channel, callback.future());
133133
callback.call();
134134

@@ -186,8 +186,8 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) throws Excep
186186
future.pendingException = cause;
187187
return;
188188
}
189-
} else if (attribute instanceof Callback) {
190-
future = Callback.class.cast(attribute).future();
189+
} else if (attribute instanceof OnLastHttpContentCallback) {
190+
future = OnLastHttpContentCallback.class.cast(attribute).future();
191191
}
192192
} catch (Throwable t) {
193193
cause = t;

client/src/main/java/org/asynchttpclient/netty/handler/WebSocketHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import org.asynchttpclient.AsyncHttpClientConfig;
3535
import org.asynchttpclient.HttpResponseHeaders;
3636
import org.asynchttpclient.HttpResponseStatus;
37-
import org.asynchttpclient.netty.Callback;
37+
import org.asynchttpclient.netty.OnLastHttpContentCallback;
3838
import org.asynchttpclient.netty.NettyResponseFuture;
3939
import org.asynchttpclient.netty.NettyResponseStatus;
4040
import org.asynchttpclient.netty.channel.ChannelManager;
@@ -52,7 +52,7 @@ public WebSocketHandler(AsyncHttpClientConfig config,//
5252
super(config, channelManager, requestSender);
5353
}
5454

55-
private class UpgradeCallback extends Callback {
55+
private class UpgradeCallback extends OnLastHttpContentCallback {
5656

5757
private final Channel channel;
5858
private final HttpResponse response;

client/src/main/java/org/asynchttpclient/netty/handler/intercept/Continue100Interceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.io.IOException;
1919

20-
import org.asynchttpclient.netty.Callback;
20+
import org.asynchttpclient.netty.OnLastHttpContentCallback;
2121
import org.asynchttpclient.netty.NettyResponseFuture;
2222
import org.asynchttpclient.netty.channel.Channels;
2323
import org.asynchttpclient.netty.request.NettyRequestSender;
@@ -34,7 +34,7 @@ public boolean exitAfterHandling100(final Channel channel, final NettyResponseFu
3434
future.setHeadersAlreadyWrittenOnContinue(true);
3535
future.setDontWriteBodyBecauseExpectContinue(false);
3636
// directly send the body
37-
Channels.setAttribute(channel, new Callback(future) {
37+
Channels.setAttribute(channel, new OnLastHttpContentCallback(future) {
3838
@Override
3939
public void call() throws IOException {
4040
Channels.setAttribute(channel, future);

client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import org.asynchttpclient.filter.IOExceptionFilter;
4747
import org.asynchttpclient.handler.AsyncHandlerExtensions;
4848
import org.asynchttpclient.handler.TransferCompletionHandler;
49-
import org.asynchttpclient.netty.Callback;
49+
import org.asynchttpclient.netty.OnLastHttpContentCallback;
5050
import org.asynchttpclient.netty.NettyResponseFuture;
5151
import org.asynchttpclient.netty.SimpleFutureListener;
5252
import org.asynchttpclient.netty.channel.ChannelManager;
@@ -526,7 +526,7 @@ public boolean isClosed() {
526526
}
527527

528528
public void drainChannelAndExecuteNextRequest(final Channel channel, final NettyResponseFuture<?> future, Request nextRequest) {
529-
Channels.setAttribute(channel, new Callback(future) {
529+
Channels.setAttribute(channel, new OnLastHttpContentCallback(future) {
530530
@Override
531531
public void call() {
532532
sendNextRequest(nextRequest, future);

0 commit comments

Comments
 (0)