[java-support] 01/02: JSPT-66: Investigate actual vs documented behavior of various HttpClient timeouts
Brent Putman
putmanb at georgetown.edu
Mon Oct 17 18:56:12 EDT 2016
This is an automated email from the git hooks/post-receive script.
putmanb pushed a commit to branch master
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=a2097d79b08bc31cfb059e4ac95caef12d658864
commit a2097d79b08bc31cfb059e4ac95caef12d658864
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Mon Oct 17 18:53:06 2016 -0400
JSPT-66: Investigate actual vs documented behavior of various HttpClient
timeouts
Add support for connectionRequestTimeout property.
---
.../java/support/httpclient/HttpClientBuilder.java | 33 +++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientBuilder.java b/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientBuilder.java
index bd88769..86b65d9 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientBuilder.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/httpclient/HttpClientBuilder.java
@@ -155,6 +155,12 @@ public class HttpClientBuilder {
* seconds)
*/
private int connectionTimeout;
+
+ /**
+ * Maximum length of time in milliseconds to wait for a connection to be returned from the connection
+ * manager. Default value: TBD;
+ */
+ private int connectionRequestTimeout;
/** Whether the SSL/TLS certificates used by the responder should be ignored. Default value: false */
private boolean connectionDisregardTLSCertificate;
@@ -253,9 +259,10 @@ public class HttpClientBuilder {
/** Resets all builder parameters to their defaults. */
public void resetDefaults() {
socketLocalAddress = null;
- socketTimeout = -1;
socketBufferSize = 8192;
+ socketTimeout = -1;
connectionTimeout = -1;
+ connectionRequestTimeout = -1;
connectionDisregardTLSCertificate = false;
connectionCloseAfterResponse = true;
connectionStaleCheck = false;
@@ -354,6 +361,26 @@ public class HttpClientBuilder {
public void setConnectionTimeout(final int timeout) {
connectionTimeout = timeout;
}
+
+ /**
+ * Gets the maximum length of time in milliseconds to wait for a connection to be returned from the connection
+ * manager. A value of less than 1 indicates no timeout.
+ *
+ * @return maximum length of time in milliseconds to wait for the connection to be established
+ */
+ public int getConnectionRequestTimeout() {
+ return connectionRequestTimeout;
+ }
+
+ /**
+ * Sets the maximum length of time in milliseconds to wait for a connection to be returned from the connection
+ * manager. A value of less than 1 indicates no timeout.
+ *
+ * @param timeout maximum length of time in milliseconds to wait for the connection to be established
+ */
+ public void setConnectionRequestTimeout(final int timeout) {
+ connectionRequestTimeout = timeout;
+ }
/**
* Gets whether the responder's SSL/TLS certificate should be ignored.
@@ -965,6 +992,10 @@ public class HttpClientBuilder {
requestConfigBuilder.setConnectTimeout(connectionTimeout);
}
+ if (connectionRequestTimeout > 0) {
+ requestConfigBuilder.setConnectionRequestTimeout(connectionRequestTimeout);
+ }
+
requestConfigBuilder.setStaleConnectionCheckEnabled(connectionStaleCheck);
requestConfigBuilder.setRedirectsEnabled(httpFollowRedirects);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list