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 2014/04/22 17:03:08 UTC

svn commit: r1589155 - in /httpcomponents/httpcore/trunk/httpcore/src: main/java/org/apache/http/pool/PoolEntry.java test/java/org/apache/http/pool/TestPoolEntry.java

Author: olegk
Date: Tue Apr 22 15:03:07 2014
New Revision: 1589155

URL: http://svn.apache.org/r1589155
Log:
Fixed misspelled method name

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java?rev=1589155&r1=1589154&r2=1589155&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/pool/PoolEntry.java Tue Apr 22 15:03:07 2014
@@ -55,7 +55,7 @@ public abstract class PoolEntry<T, C> {
     private final T route;
     private final C conn;
     private final long created;
-    private final long validUnit;
+    private final long validityDeadline;
 
     @GuardedBy("this")
     private long updated;
@@ -86,11 +86,11 @@ public abstract class PoolEntry<T, C> {
         this.conn = conn;
         this.created = System.currentTimeMillis();
         if (timeToLive > 0) {
-            this.validUnit = this.created + tunit.toMillis(timeToLive);
+            this.validityDeadline = this.created + tunit.toMillis(timeToLive);
         } else {
-            this.validUnit = Long.MAX_VALUE;
+            this.validityDeadline = Long.MAX_VALUE;
         }
-        this.expiry = this.validUnit;
+        this.expiry = this.validityDeadline;
     }
 
     /**
@@ -120,8 +120,19 @@ public abstract class PoolEntry<T, C> {
         return this.created;
     }
 
+    /**
+     * @since 4.4
+     */
+    public long getValidityDeadline() {
+        return this.validityDeadline;
+    }
+
+    /**
+     * @deprecated use {@link #getValidityDeadline()}
+     */
+    @Deprecated
     public long getValidUnit() {
-        return this.validUnit;
+        return this.validityDeadline;
     }
 
     public Object getState() {
@@ -149,7 +160,7 @@ public abstract class PoolEntry<T, C> {
         } else {
             newExpiry = Long.MAX_VALUE;
         }
-        this.expiry = Math.min(newExpiry, this.validUnit);
+        this.expiry = Math.min(newExpiry, this.validityDeadline);
     }
 
     public synchronized boolean isExpired(final long now) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java?rev=1589155&r1=1589154&r2=1589155&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/pool/TestPoolEntry.java Tue Apr 22 15:03:07 2014
@@ -69,8 +69,8 @@ public class TestPoolEntry {
         final long now = System.currentTimeMillis();
         Assert.assertEquals("route1", entry1.getRoute());
         Assert.assertTrue(now >= entry1.getCreated());
-        Assert.assertEquals(entry1.getValidUnit(), entry1.getExpiry());
-        Assert.assertEquals(entry1.getCreated() + 10L, entry1.getValidUnit());
+        Assert.assertEquals(entry1.getValidityDeadline(), entry1.getExpiry());
+        Assert.assertEquals(entry1.getCreated() + 10L, entry1.getValidityDeadline());
     }
 
     @Test
@@ -95,8 +95,8 @@ public class TestPoolEntry {
     @Test
     public void testValidInfinitely() throws Exception {
         final MockPoolEntry entry1 = new MockPoolEntry("route1", 0L, TimeUnit.MILLISECONDS);
-        Assert.assertEquals(Long.MAX_VALUE, entry1.getValidUnit());
-        Assert.assertEquals(entry1.getValidUnit(), entry1.getExpiry());
+        Assert.assertEquals(Long.MAX_VALUE, entry1.getValidityDeadline());
+        Assert.assertEquals(entry1.getValidityDeadline(), entry1.getExpiry());
     }
 
     @Test