You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2017/07/16 20:46:04 UTC

[1/3] httpcomponents-client git commit: EOL fixing [Forced Update!]

Repository: httpcomponents-client
Updated Branches:
  refs/heads/master 9da9f2c27 -> 669a53150 (forced update)


EOL fixing


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/49989d80
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/49989d80
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/49989d80

Branch: refs/heads/master
Commit: 49989d8044e0cb2e16773c94341f844f9d007b1f
Parents: c757f60
Author: Sebb <se...@apache.org>
Authored: Fri Jun 30 00:22:28 2017 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sun Jul 16 22:41:46 2017 +0200

----------------------------------------------------------------------
 .travis.yml | 50 +++++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/49989d80/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index cafe93d..c2fac09 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,25 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-language: java
-sudo: false
-
-jdk:
-  - openjdk7
-  - oraclejdk7
-  - oraclejdk8
-
-after_success:
-  - mvn clean cobertura:cobertura coveralls:report
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+language: java
+sudo: false
+
+jdk:
+  - openjdk7
+  - oraclejdk7
+  - oraclejdk8
+
+after_success:
+  - mvn clean cobertura:cobertura coveralls:report


[2/3] httpcomponents-client git commit: [HTTPCLIENT-1858] Clone some code from Log4j 2 to cache a StringBuilder in a ThreadLocal.

Posted by ol...@apache.org.
[HTTPCLIENT-1858] Clone some code from Log4j 2 to cache a StringBuilder in a ThreadLocal.


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/527dce78
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/527dce78
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/527dce78

Branch: refs/heads/master
Commit: 527dce78a7950509fc9e301f405a9da268b7006d
Parents: 49989d8
Author: Gary Gregory <gg...@apache.org>
Authored: Sun Jul 16 12:01:54 2017 -0700
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sun Jul 16 22:42:16 2017 +0200

----------------------------------------------------------------------
 RELEASE_NOTES.txt                               |  4 ++-
 .../hc/client5/http/impl/logging/Wire.java      | 38 +++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/527dce78/RELEASE_NOTES.txt
----------------------------------------------------------------------
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index dbbf0a0..a0dd7d4 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,10 +1,12 @@
-Release 5.0-ALPHA3
+Release 5.0-ALPHA3
 -------------------
 
 * [HTTPCLIENT-1845]: Extract InputStreamFactory classes out of GzipDecompressingEntity and 
   DeflateDecompressingEntity for reuse and to create less garbage.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* [HTTPCLIENT-1858] Alleviate GC pressure due to wire logging.
+
 
 Release 5.0-ALPHA2
 -------------------

http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/527dce78/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
index a3abb5e..e6b09b1 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/logging/Wire.java
@@ -34,6 +34,42 @@ import org.apache.logging.log4j.Logger;
 
 class Wire {
 
+    private static final int MAX_STRING_BUILDER_SIZE = 2048;
+
+    private static final ThreadLocal<StringBuilder> threadLocal = new ThreadLocal<>();
+
+    /**
+     * Returns a {@code StringBuilder} that this Layout implementation can use to write the formatted log event to.
+     *
+     * @return a {@code StringBuilder}
+     */
+    private static StringBuilder getStringBuilder() {
+        StringBuilder result = threadLocal.get();
+        if (result == null) {
+            result = new StringBuilder(MAX_STRING_BUILDER_SIZE);
+            threadLocal.set(result);
+        }
+        // TODO Delegate to Log4j's 2.9 StringBuilds.trimToMaxSize() when it is released.
+        trimToMaxSize(result, MAX_STRING_BUILDER_SIZE);
+        result.setLength(0);
+        return result;
+    }
+
+    /**
+     * Ensures that the char[] array of the specified StringBuilder does not exceed the specified number of characters.
+     * This method is useful to ensure that excessively long char[] arrays are not kept in memory forever.
+     *
+     * @param stringBuilder the StringBuilder to check
+     * @param maxSize the maximum number of characters the StringBuilder is allowed to have
+     */
+    // TODO Delete wheb Log4j's 2.9 (see #trimToMaxSize(StringBuild))
+    private static void trimToMaxSize(final StringBuilder stringBuilder, final int maxSize) {
+        if (stringBuilder != null && stringBuilder.length() > maxSize) {
+            stringBuilder.setLength(maxSize);
+            stringBuilder.trimToSize();
+        }
+    }
+
     private final Logger log;
     private final String id;
 
@@ -44,7 +80,7 @@ class Wire {
     }
 
     private void wire(final String header, final byte[] b, final int pos, final int off) {
-        final StringBuilder buffer = new StringBuilder();
+        final StringBuilder buffer = getStringBuilder();
         for (int i = 0; i < off; i++) {
             final int ch = b[pos + i];
             if (ch == 13) {


[3/3] httpcomponents-client git commit: Fixed javadocs in ContentCompressionExec

Posted by ol...@apache.org.
Fixed javadocs in ContentCompressionExec


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/669a5315
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/669a5315
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/669a5315

Branch: refs/heads/master
Commit: 669a53150248a086fa7bfd7a1431765f7abe7021
Parents: 527dce7
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Sun Jul 16 22:43:53 2017 +0200
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sun Jul 16 22:43:53 2017 +0200

----------------------------------------------------------------------
 .../apache/hc/client5/http/impl/sync/ContentCompressionExec.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/669a5315/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/ContentCompressionExec.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/ContentCompressionExec.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/ContentCompressionExec.java
index 888a45c..df6638c 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/ContentCompressionExec.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/sync/ContentCompressionExec.java
@@ -94,8 +94,8 @@ public final class ContentCompressionExec implements ExecChainHandler {
      * Handles {@code gzip} and {@code deflate} compressed entities by using the following
      * decoders:
      * <ul>
-     * <li>gzip - see {@link GZIPInputStream}</li>
-     * <li>deflate - see {@link DeflateInputStream}</li>
+     * <li>gzip - see {@link java.util.zip.GZIPInputStream}</li>
+     * <li>deflate - see {@link org.apache.hc.client5.http.entity.DeflateInputStream}</li>
      * </ul>
      */
     public ContentCompressionExec() {