[java-support] branch master updated: Fix typo in property name, add new methods, deprecate old ones.

Brent Putman putmanb at georgetown.edu
Mon Oct 17 17:39:45 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=062124c7ba1f1036a176356ca6609f0dfe70e53e

The following commit(s) were added to refs/heads/master by this push:
       new  062124c   Fix typo in property name, add new methods, deprecate old ones.
062124c is described below

commit 062124c7ba1f1036a176356ca6609f0dfe70e53e
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Mon Oct 17 17:39:43 2016 -0400

    Fix typo in property name, add new methods, deprecate old ones.
---
 .../java/support/httpclient/HttpClientBuilder.java | 47 +++++++++++++++++-----
 1 file changed, 37 insertions(+), 10 deletions(-)

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 21949c7..bd88769 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
@@ -25,10 +25,6 @@ import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import net.shibboleth.utilities.java.support.collection.IterableSupport;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequestInterceptor;
 import org.apache.http.HttpResponseInterceptor;
@@ -47,6 +43,10 @@ import org.apache.http.util.CharsetUtils;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 
+import net.shibboleth.utilities.java.support.collection.IterableSupport;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
 //TODO retry attempts, keep alive strategy
 
 /**
@@ -169,7 +169,7 @@ public class HttpClientBuilder {
      * Whether to check a connection for staleness before using. This can be an expensive operation. Default value:
      * false
      */
-    private boolean connectionStalecheck;
+    private boolean connectionStaleCheck;
 
     /** Host name of the HTTP proxy server through which connections will be made. Default value: null. */
     @Nullable private String connectionProxyHost;
@@ -258,7 +258,7 @@ public class HttpClientBuilder {
         connectionTimeout = -1;
         connectionDisregardTLSCertificate = false;
         connectionCloseAfterResponse = true;
-        connectionStalecheck = false;
+        connectionStaleCheck = false;
         connectionProxyHost = null;
         connectionProxyPort = 8080;
         connectionProxyUsername = null;
@@ -423,9 +423,11 @@ public class HttpClientBuilder {
      * Gets whether reused connections are checked if they are closed before being used by the client.
      * 
      * @return whether reused connections are checked if they are closed before being used by the client
+     * 
+     * @deprecated use {@link #isConnectionStaleCheck()}
      */
     public boolean isConnectionStalecheck() {
-        return connectionStalecheck;
+        return isConnectionStaleCheck();
     }
 
     /**
@@ -435,9 +437,34 @@ public class HttpClientBuilder {
      * appropriate.
      * 
      * @param check whether reused connections are checked if they are closed before being used by the client
+     * 
+     * @deprecated use {@link #setConnectionStaleCheck(boolean)}
      */
     public void setConnectionStalecheck(final boolean check) {
-        connectionStalecheck = check;
+        setConnectionStaleCheck(check);
+    }
+    
+    /**
+     * Gets whether reused connections are checked if they are closed before being used by the client.
+     * 
+     * @return whether reused connections are checked if they are closed before being used by the client
+     * 
+     * 
+     */
+    public boolean isConnectionStaleCheck() {
+        return connectionStaleCheck;
+    }
+
+    /**
+     * Sets whether reused connections are checked if they are closed before being used by the client. Checking can take
+     * up to 30ms (per request). If checking is turned off an I/O error occurs if the connection is used request. This
+     * should be enabled uncles the code using the client explicitly handles the error case and retries connection as
+     * appropriate.
+     * 
+     * @param check whether reused connections are checked if they are closed before being used by the client
+     */
+    public void setConnectionStaleCheck(final boolean check) {
+        connectionStaleCheck = check;
     }
 
     /**
@@ -937,8 +964,8 @@ public class HttpClientBuilder {
         if (connectionTimeout > 0) {
             requestConfigBuilder.setConnectTimeout(connectionTimeout);
         }
-
-        requestConfigBuilder.setStaleConnectionCheckEnabled(connectionStalecheck);
+        
+        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