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 2021/06/10 13:02:38 UTC

[httpcomponents-core] branch master updated: * Convert argument to const * Correct javadoc for isStale()

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f585460  * Convert argument to const * Correct javadoc for isStale()
f585460 is described below

commit f5854600e056acde8d21538addc9cbfe5b60f6ae
Author: Pavel Raev <ra...@yoomoney.ru>
AuthorDate: Thu Jun 10 15:26:17 2021 +0300

    * Convert argument to const
    * Correct javadoc for isStale()
---
 .../java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java  | 3 ++-
 .../src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java  | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
index 9d2531d..f22ddc2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
@@ -67,6 +67,7 @@ import org.apache.hc.core5.util.Timeout;
 
 class BHttpConnectionBase implements BHttpConnection {
 
+    private static final Timeout STALE_CHECK_TIMEOUT = Timeout.ofMilliseconds(1);
     final Http1Config http1Config;
     final SessionInputBufferImpl inBuffer;
     final SessionOutputBufferImpl outbuffer;
@@ -292,7 +293,7 @@ class BHttpConnectionBase implements BHttpConnection {
             return true;
         }
         try {
-            final int bytesRead = fillInputBuffer(Timeout.ofMilliseconds(1));
+            final int bytesRead = fillInputBuffer(STALE_CHECK_TIMEOUT);
             return bytesRead < 0;
         } catch (final SocketTimeoutException ex) {
             return false;
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java
index d96fe35..c23af9b 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java
@@ -62,9 +62,9 @@ public interface BHttpConnection extends HttpConnection {
      * method may block for a small amount of time before returning a result.
      * It is therefore an <i>expensive</i> operation.
      *
-     * @return  {@code true} if attempts to use this connection are
-     *          likely to succeed, or {@code false} if they are likely
-     *          to fail and this connection should be closed
+     * @return  {@code true} if attempts to use this connection are likely
+     *          to fail and this connection should be closed,
+     *          or {@code false} if they are likely to succeed
      */
     boolean isStale() throws IOException;