Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump async-http-client to 3.0.1 #17558

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ name: AsyncHttpClient asynchttpclient
license_category: binary
module: java-core
license_name: Apache License version 2.0
version: 2.5.3
version: 3.0.1
libraries:
- org.asynchttpclient: async-http-client
- org.asynchttpclient: async-http-client-netty-utils
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,7 @@
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<!-- Uses Netty 4.1.x -->
<version>2.5.3</version>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.primitives.Ints;
import io.netty.handler.codec.http.HttpHeaders;
import org.apache.druid.concurrent.ConcurrentAwaitableCounter;
import org.apache.druid.java.util.common.ISE;
Expand All @@ -45,6 +44,7 @@
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayDeque;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;
Expand Down Expand Up @@ -773,7 +773,7 @@ private void send(byte[] buffer, int length) throws Exception
request.setHeader(HttpHeaders.Names.AUTHORIZATION, "Basic " + encoded);
}

request.setRequestTimeout(Ints.saturatedCast(timeoutMillis));
request.setRequestTimeout(Duration.ofMillis(timeoutMillis));

ListenableFuture<Response> future = client.executeRequest(request);
Response response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.junit.Test;

import java.io.IOException;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicLong;

public class HttpEmitterTest
Expand All @@ -56,8 +57,8 @@ public void setup()
@Override
protected ListenableFuture<Response> go(Request request)
{
int timeout = request.getRequestTimeout();
timeoutUsed.set(timeout);
Duration timeout = request.getRequestTimeout();
timeoutUsed.set(timeout.toMillis());
return GoHandlers.immediateFuture(EmitterTest.okResponse());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -81,7 +82,7 @@ public void run()
requestStart = System.currentTimeMillis();
Future<?> future = client
.prepareGet(StringUtils.format("http://localhost:%d/", serverSocket.getLocalPort()))
.setRequestTimeout(2000)
.setRequestTimeout(Duration.ofMillis(2000))
.execute();
System.out.println("created future in: " + (System.currentTimeMillis() - requestStart));
future.get(3000, TimeUnit.MILLISECONDS);
Expand All @@ -103,7 +104,7 @@ private void warmUp(ServerSocket serverSocket, DefaultAsyncHttpClient client)
try {
Future<?> future = client
.prepareGet(StringUtils.format("http://localhost:%d/", serverSocket.getLocalPort()))
.setRequestTimeout(100)
.setRequestTimeout(Duration.ofMillis(100))
.execute();
future.get();
}
Expand Down
Loading