You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by mi...@apache.org on 2019/12/16 10:30:11 UTC

[httpcomponents-client] branch HTTPCLIENT-2036 updated (0a02e41 -> 4a1e587)

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

michaelo pushed a change to branch HTTPCLIENT-2036
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.


    from 0a02e41  More work
     new 82841a9  Align to seconds due to HTTP date resolution
     new 4a1e587  Use Integer.MAX_VALUE

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../hc/client5/http/impl/cache/CacheValidityPolicy.java    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)


[httpcomponents-client] 02/02: Use Integer.MAX_VALUE

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch HTTPCLIENT-2036
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 4a1e587eea030c1edd743333ecb7b23dcca367bc
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Dec 16 11:29:42 2019 +0100

    Use Integer.MAX_VALUE
---
 .../java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
index cc338ac..ef2b82c 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
@@ -43,7 +43,7 @@ import org.apache.hc.core5.util.TimeValue;
 
 class CacheValidityPolicy {
 
-    public static final TimeValue MAX_AGE = TimeValue.ofSeconds(2147483648L);
+    public static final TimeValue MAX_AGE = TimeValue.ofSeconds(Integer.MAX_VALUE + 1L);
 
     CacheValidityPolicy() {
         super();


[httpcomponents-client] 01/02: Align to seconds due to HTTP date resolution

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch HTTPCLIENT-2036
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit 82841a945cd6a5925f8e138c39e7857eb0138a01
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Mon Dec 16 11:17:06 2019 +0100

    Align to seconds due to HTTP date resolution
---
 .../hc/client5/http/impl/cache/CacheValidityPolicy.java      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
index fdb0f7e..cc338ac 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheValidityPolicy.java
@@ -69,7 +69,7 @@ class CacheValidityPolicy {
             return TimeValue.ZERO_MILLISECONDS;
         }
         final long diff = expiry.getTime() - dateValue.getTime();
-        return TimeValue.ofMilliseconds(diff);
+        return TimeValue.ofSeconds(diff / 1000);
     }
 
     public boolean isResponseFresh(final HttpCacheEntry entry, final Date now) {
@@ -105,7 +105,7 @@ class CacheValidityPolicy {
             if (diff < 0) {
                 return TimeValue.ZERO_MILLISECONDS;
             }
-            return TimeValue.ofMilliseconds((long) (coefficient * diff));
+            return TimeValue.ofSeconds((long) (coefficient * diff / 1000));
         }
 
         return defaultLifetime;
@@ -205,7 +205,7 @@ class CacheValidityPolicy {
         if (diff < 0L) {
             return TimeValue.ZERO_MILLISECONDS;
         }
-        return TimeValue.ofMilliseconds(diff);
+        return TimeValue.ofSeconds(diff / 1000);
     }
 
     protected long getAgeValue(final HttpCacheEntry entry) {
@@ -234,16 +234,16 @@ class CacheValidityPolicy {
 
     protected TimeValue getResponseDelay(final HttpCacheEntry entry) {
         final long diff = entry.getResponseDate().getTime() - entry.getRequestDate().getTime();
-        return TimeValue.ofMilliseconds(diff);
+        return TimeValue.ofSeconds(diff / 1000);
     }
 
     protected TimeValue getCorrectedInitialAge(final HttpCacheEntry entry) {
-        return TimeValue.ofMilliseconds(getCorrectedReceivedAge(entry).toMillis() + getResponseDelay(entry).toMillis());
+        return TimeValue.ofSeconds(getCorrectedReceivedAge(entry).toSeconds() + getResponseDelay(entry).toSeconds());
     }
 
     protected TimeValue getResidentTime(final HttpCacheEntry entry, final Date now) {
         final long diff = now.getTime() - entry.getResponseDate().getTime();
-        return TimeValue.ofMilliseconds(diff);
+        return TimeValue.ofSeconds(diff / 1000);
     }
 
     protected long getMaxAge(final HttpCacheEntry entry) {