eclipse-ee4j / eclipse-ee4j/jersey
Client not thread safe with ApacheConnectorProvider
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
Executing simple GET requests on a target which requires authentication (BASIC in my case) on more than one thread and the process quickly hangs.
```
@Test public void get() throws Exception
{
// Works as expected if only a single thread is used ExecutorService service = Executors.newFixedThreadPool(2);
try
{
ArrayList> futures = new ArrayList<>();
for (int i=0; i<10; i++)
{
futures.add(service.submit(new GetTask()));
}
for (Future future: futures)
{
System.out.println(future.get(5, TimeUnit.SECONDS));
}
}
finally
{
service.shutdown();
}
}
private class GetTask implements Callable
{
public String call() throws Exception
{
return client.target("https://optrakbi.optrak.com/filestore/readme.txt").request().buildGet().invoke(String.class); }
}
```
#### Environment
Ubuntu 15.04, Oracle JDK 8
#### Affected Versions
[2.22.1]
Contributor guide
Assessment
This issue has not been assessed yet.