FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow to configure connection pool timeout by martiner · Pull Request #703 · docker-java/docker-java · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.github.dockerjava.api.command.UpdateContainerCmd;
import com.github.dockerjava.core.SSLConfig;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
Expand Down Expand Up @@ -110,6 +111,8 @@ public class JerseyDockerCmdExecFactory implements DockerCmdExecFactory {

private Integer maxPerRouteConnections = null;

private Integer connectionRequestTimeout = null;

private ClientRequestFilter[] clientRequestFilters = null;

private ClientResponseFilter[] clientResponseFilters = null;
Expand Down Expand Up @@ -216,9 +219,10 @@ public void shutdown() {
clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connManager);

// Configure connection pool timeout
// clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, RequestConfig.custom()
// .setConnectionRequestTimeout(1000).build());

if (connectionRequestTimeout != null) {
clientConfig.property(ApacheClientProperties.REQUEST_CONFIG, RequestConfig.custom()
.setConnectionRequestTimeout(connectionRequestTimeout).build());
}
ClientBuilder clientBuilder = ClientBuilder.newBuilder().withConfig(clientConfig);

if (sslContext != null) {
Expand Down Expand Up @@ -570,6 +574,11 @@ public JerseyDockerCmdExecFactory withMaxPerRouteConnections(Integer maxPerRoute
return this;
}

public JerseyDockerCmdExecFactory withConnectionRequestTimeout(Integer connectionRequestTimeout) {
this.connectionRequestTimeout = connectionRequestTimeout;
return this;
}

public JerseyDockerCmdExecFactory withClientResponseFilters(ClientResponseFilter... clientResponseFilter) {
this.clientResponseFilters = clientResponseFilter;
return this;
Expand Down

Back | FazBrowse Home | New Git URL