hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1791745 - in /httpcomponents/httpcore/trunk/httpcore5/src: main/java/org/apache/hc/core5/http/config/ main/java/org/apache/hc/core5/http/impl/bootstrap/ main/java/org/apache/hc/core5/pool/ main/java/org/apache/hc/core5/reactor/ main/java/o...
Date Tue, 18 Apr 2017 05:48:03 GMT
Author: ggregory
Date: Tue Apr 18 05:48:03 2017
New Revision: 1791745

URL: http://svn.apache.org/viewvc?rev=1791745&view=rev
Log:
[HTTPCORE-451] Add a TimeValue class to wrap a long and a TimeUnit. Rename ZERO_MILLIS to
ZERO_MILLISECONDS because the JRE class TimeUnit defines MILLISECONDS (not MILLIS). Also refactor
some common patters into static methods.

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/PoolEntry.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
    httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestPoolEntry.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestRouteSpecificPool.java
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/config/SocketConfig.java
Tue Apr 18 05:48:03 2017
@@ -229,7 +229,7 @@ public class SocketConfig {
         private int backlogSize;
 
         Builder() {
-            this.soTimeout = TimeValue.ZERO_MILLIS;
+            this.soTimeout = TimeValue.ZERO_MILLISECONDS;
             this.soReuseAddress = false;
             this.soLinger = TimeValue.NEG_ONE_SECONDS;
             this.soKeepAlive = false;
@@ -300,7 +300,7 @@ public class SocketConfig {
 
         public SocketConfig build() {
             return new SocketConfig(
-                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLIS,
+                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLISECONDS,
                     soReuseAddress,
                     soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
                     soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
Tue Apr 18 05:48:03 2017
@@ -190,7 +190,7 @@ public class HttpRequester implements Gr
         Args.notNull(request, "HTTP request");
         final Future<PoolEntry<HttpHost, HttpClientConnection>> leaseFuture =
connPool.lease(targetHost, null, null);
         final PoolEntry<HttpHost, HttpClientConnection> poolEntry;
-        final TimeValue timeout = connectTimeout != null ? connectTimeout : TimeValue.ZERO_MILLIS;
+        final TimeValue timeout = connectTimeout != null ? connectTimeout : TimeValue.ZERO_MILLISECONDS;
 
         try {
             poolEntry = leaseFuture.get(timeout.getDuration(), timeout.getTimeUnit());

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/PoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/PoolEntry.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/PoolEntry.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/PoolEntry.java
Tue Apr 18 05:48:03 2017
@@ -69,7 +69,7 @@ public final class PoolEntry<T, C extend
     public PoolEntry(final T route, final TimeValue timeToLive) {
         super();
         this.route = Args.notNull(route, "Route");
-        this.timeToLive = timeToLive != null ? timeToLive : TimeValue.NEG_ONE_MILLIS;
+        this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive);
         this.connRef = new AtomicReference<>(null);
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
Tue Apr 18 05:48:03 2017
@@ -90,7 +90,7 @@ public class StrictConnPool<T, C extends
         super();
         Args.positive(defaultMaxPerRoute, "Max per route value");
         Args.positive(maxTotal, "Max total value");
-        this.timeToLive = timeToLive != null ? timeToLive : TimeValue.NEG_ONE_MILLIS;
+        this.timeToLive = TimeValue.defaultsToNegativeOneMillisecond(timeToLive);
         this.connPoolListener = connPoolListener;
         this.policy = policy != null ? policy : ConnPoolPolicy.LIFO;
         this.routeToPool = new HashMap<>();
@@ -106,7 +106,7 @@ public class StrictConnPool<T, C extends
     }
 
     public StrictConnPool(final int defaultMaxPerRoute, final int maxTotal) {
-        this(defaultMaxPerRoute, maxTotal, TimeValue.NEG_ONE_MILLIS, ConnPoolPolicy.LIFO,
null);
+        this(defaultMaxPerRoute, maxTotal, TimeValue.NEG_ONE_MILLISECONDS, ConnPoolPolicy.LIFO,
null);
     }
 
     public boolean isShutdown() {
@@ -173,11 +173,11 @@ public class StrictConnPool<T, C extends
 
     @Override
     public Future<PoolEntry<T, C>> lease(final T route, final Object state, final
FutureCallback<PoolEntry<T, C>> callback) {
-        return lease(route, state, TimeValue.NEG_ONE_MILLIS, callback);
+        return lease(route, state, TimeValue.NEG_ONE_MILLISECONDS, callback);
     }
 
     public Future<PoolEntry<T, C>> lease(final T route, final Object state) {
-        return lease(route, state, TimeValue.NEG_ONE_MILLIS, null);
+        return lease(route, state, TimeValue.NEG_ONE_MILLISECONDS, null);
     }
 
     @Override

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
Tue Apr 18 05:48:03 2017
@@ -229,7 +229,7 @@ public final class IOReactorConfig {
         Builder() {
             this.selectInterval = 1000;
             this.ioThreadCount = AVAIL_PROCS;
-            this.soTimeout = TimeValue.ZERO_MILLIS;
+            this.soTimeout = TimeValue.ZERO_MILLISECONDS;
             this.soReuseAddress = false;
             this.soLinger = TimeValue.NEG_ONE_SECONDS;
             this.soKeepAlive = false;
@@ -302,7 +302,7 @@ public final class IOReactorConfig {
         public IOReactorConfig build() {
             return new IOReactorConfig(
                     selectInterval, ioThreadCount,
-                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLIS,
+                    soTimeout != null ? soTimeout : TimeValue.ZERO_MILLISECONDS,
                     soReuseAddress,
                     soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
                     soKeepAlive,

Modified: httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
Tue Apr 18 05:48:03 2017
@@ -40,10 +40,10 @@ import org.apache.hc.core5.annotation.Th
 @Contract(threading = ThreadingBehavior.IMMUTABLE)
 public class TimeValue {
 
-    public static final TimeValue MAX_VALUE = new TimeValue(Long.MAX_VALUE, TimeUnit.DAYS);
-    public static final TimeValue NEG_ONE_MILLIS = new TimeValue(-1, TimeUnit.MILLISECONDS);
-    public static final TimeValue NEG_ONE_SECONDS = new TimeValue(-1, TimeUnit.SECONDS);
-    public static final TimeValue ZERO_MILLIS = new TimeValue(0, TimeUnit.MILLISECONDS);
+    private static final int UNDEFINED = -1;
+    public static final TimeValue NEG_ONE_MILLISECONDS = new TimeValue(UNDEFINED, TimeUnit.MILLISECONDS);
+    public static final TimeValue NEG_ONE_SECONDS = new TimeValue(UNDEFINED, TimeUnit.SECONDS);
+    public static final TimeValue ZERO_MILLISECONDS = new TimeValue(0, TimeUnit.MILLISECONDS);
 
     /**
      * Returns the given {@code long} value as an {@code int} where long values out of int
range are returned as
@@ -66,6 +66,55 @@ public class TimeValue {
         return (int) value;
     }
 
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then
returns the given
+     * {@code defaultValue}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @param defaultValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@code defaultValue}
+     */
+    public static TimeValue defaultsTo(final TimeValue timeValue, final TimeValue defaultValue)
{
+        return timeValue != null ? timeValue : defaultValue;
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then
returns {@link #ZERO_MILLISECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #ZERO_MILLISECONDS}
+     */
+    public static TimeValue defaultsToZeroMillis(final TimeValue timeValue) {
+        return defaultsTo(timeValue, ZERO_MILLISECONDS);
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then
returns
+     * {@link #NEG_ONE_SECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+     */
+    public static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue) {
+        return defaultsTo(timeValue, NEG_ONE_MILLISECONDS);
+    }
+
+    /**
+     * Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then
returns
+     * {@link #NEG_ONE_SECONDS}.
+     *
+     * @param timeValue
+     *            may be {@code null}
+     * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+     */
+    public static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue) {
+        return defaultsTo(timeValue, NEG_ONE_SECONDS);
+    }
+
     public static TimeValue of(final long duration, final TimeUnit timeUnit) {
         return new TimeValue(duration, timeUnit);
     }

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestPoolEntry.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestPoolEntry.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestPoolEntry.java
Tue Apr 18 05:48:03 2017
@@ -64,7 +64,7 @@ public class TestPoolEntry {
 
     @Test
     public void testValidInfinitely() throws Exception {
-        final PoolEntry<String, HttpConnection> entry1 = new PoolEntry<>("route1",
TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, HttpConnection> entry1 = new PoolEntry<>("route1",
TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(Mockito.mock(HttpConnection.class));
         Assert.assertEquals(Long.MAX_VALUE, entry1.getValidityDeadline());
         Assert.assertEquals(entry1.getValidityDeadline(), entry1.getExpiry());
@@ -72,12 +72,12 @@ public class TestPoolEntry {
 
     @Test
     public void testExpiry() throws Exception {
-        final PoolEntry<String, HttpConnection> entry1 = new PoolEntry<>("route1",
TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, HttpConnection> entry1 = new PoolEntry<>("route1",
TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(Mockito.mock(HttpConnection.class));
         Assert.assertEquals(Long.MAX_VALUE, entry1.getExpiry());
         entry1.updateExpiry(TimeValue.of(50L, TimeUnit.MILLISECONDS));
         Assert.assertEquals(entry1.getUpdated() + 50L, entry1.getExpiry());
-        entry1.updateExpiry(TimeValue.ZERO_MILLIS);
+        entry1.updateExpiry(TimeValue.ZERO_MILLISECONDS);
         Assert.assertEquals(Long.MAX_VALUE, entry1.getExpiry());
 
         final PoolEntry<String, HttpConnection> entry2 = new PoolEntry<>("route1",
TimeValue.of(100L, TimeUnit.MILLISECONDS));

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestRouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestRouteSpecificPool.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestRouteSpecificPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestRouteSpecificPool.java
Tue Apr 18 05:48:03 2017
@@ -52,7 +52,7 @@ public class TestRouteSpecificPool {
     public void testAdd() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry.assignConnection(conn);
         Assert.assertEquals(1, pool.getAllocatedCount());
         Assert.assertEquals(0, pool.getAvailableCount());
@@ -65,13 +65,13 @@ public class TestRouteSpecificPool {
     public void testLeaseRelease() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn1 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(conn1);
         final GracefullyCloseable conn2 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry2.assignConnection(conn2);
         final GracefullyCloseable conn3 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry3.assignConnection(conn3);
 
         Assert.assertNotNull(entry1);
@@ -105,13 +105,13 @@ public class TestRouteSpecificPool {
     public void testLeaseOrder() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn1 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(conn1);
         final GracefullyCloseable conn2 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry2.assignConnection(conn2);
         final GracefullyCloseable conn3 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry3.assignConnection(conn3);
 
         Assert.assertNotNull(entry1);
@@ -137,13 +137,13 @@ public class TestRouteSpecificPool {
     public void testLeaseReleaseStateful() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn1 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(conn1);
         final GracefullyCloseable conn2 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry2.assignConnection(conn2);
         final GracefullyCloseable conn3 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry3.assignConnection(conn3);
 
         Assert.assertNotNull(entry1);
@@ -191,13 +191,13 @@ public class TestRouteSpecificPool {
     public void testRemove() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn1 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(conn1);
         final GracefullyCloseable conn2 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry2.assignConnection(conn2);
         final GracefullyCloseable conn3 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry3 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry3.assignConnection(conn3);
 
         Assert.assertNotNull(entry1);
@@ -246,10 +246,10 @@ public class TestRouteSpecificPool {
     public void testShutdown() throws Exception {
         final RoutePool<String, GracefullyCloseable> pool = new RoutePool<>("whatever");
         final GracefullyCloseable conn1 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry1 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry1.assignConnection(conn1);
         final GracefullyCloseable conn2 = Mockito.mock(GracefullyCloseable.class);
-        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLIS);
+        final PoolEntry<String, GracefullyCloseable> entry2 = pool.createEntry(TimeValue.ZERO_MILLISECONDS);
         entry2.assignConnection(conn2);
 
         Assert.assertNotNull(entry1);

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java?rev=1791745&r1=1791744&r2=1791745&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
Tue Apr 18 05:48:03 2017
@@ -108,7 +108,7 @@ public class TestStrictConnPool {
     public void testLeaseIllegal() throws Exception {
         final StrictConnPool<String, HttpConnection> pool = new StrictConnPool<>(2,
10);
         try {
-            pool.lease(null, null, TimeValue.ZERO_MILLIS, null);
+            pool.lease(null, null, TimeValue.ZERO_MILLISECONDS, null);
             Assert.fail("IllegalArgumentException should have been thrown");
         } catch (final IllegalArgumentException expected) {
         }



Mime
View raw message