Skip to content
Merged
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 build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ plugins {

allprojects {
group = 'com.spectralogic.ds3'
version = '3.5.5'
version = '3.5.6'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Map;
import java.util.concurrent.Semaphore;

import static com.spectralogic.ds3client.utils.Signature.canonicalizeAmzHeaders;
import static com.spectralogic.ds3client.utils.Signature.canonicalizeResource;
Expand All @@ -88,6 +89,7 @@ public class NetworkClientImpl implements NetworkClient {

final private CloseableHttpClient client;
final private HttpHost host;
final private Semaphore clientLock;

public NetworkClientImpl(final ConnectionDetails connectionDetails) {
this(connectionDetails, createDefaultClient(connectionDetails));
Expand All @@ -100,6 +102,7 @@ public NetworkClientImpl(final ConnectionDetails connectionDetails, final Closea
this.connectionDetails = connectionDetails;
this.host = buildHost(connectionDetails);
this.client = client;
this.clientLock = new Semaphore(MAX_CONNECTION_PER_ROUTE);
} catch (final MalformedURLException e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -236,11 +239,16 @@ public CloseableHttpResponse execute() throws IOException {
}

final HttpRequest httpRequest = this.buildHttpRequest();
this.addHeaders(httpRequest);
clientLock.acquireUninterruptibly();
try {
return client.execute(this.host, httpRequest, this.getContext());
} catch (final javax.net.ssl.SSLHandshakeException e) {
throw new InvalidCertificate("The certificate on black pearl is not a strong certificate and the request is being aborted. Configure with the insecure option to perform the request.", e);
this.addHeaders(httpRequest);
try {
return client.execute(this.host, httpRequest, this.getContext());
} catch (final javax.net.ssl.SSLHandshakeException e) {
throw new InvalidCertificate("The certificate on black pearl is not a strong certificate and the request is being aborted. Configure with the insecure option to perform the request.", e);
}
} finally {
clientLock.release();
}
}

Expand Down