[HTTPCORE-611] Minor glitches with TimeValue. (#155)
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
index 7f4d43f..2c4bb0a 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
@@ -139,7 +139,7 @@ protected void validateSession(
final TimeValue timeValue = validateAfterInactivity;
if (TimeValue.isPositive(timeValue)) {
final long lastAccessTime = Math.min(ioSession.getLastReadTime(), ioSession.getLastWriteTime());
- final long deadline = lastAccessTime + timeValue.toMillis();
+ final long deadline = lastAccessTime + timeValue.toMilliseconds();
if (deadline <= System.currentTimeMillis()) {
final Timeout socketTimeoutMillis = ioSession.getSocketTimeout();
ioSession.enqueue(new PingCommand(new BasicPingHandler(new Callback<Boolean>() {
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
index 03848fb..ef61842 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark/HttpBenchmark.java
@@ -479,7 +479,7 @@ private Results doExecute(final HttpAsyncRequester requester, final Stats stats)
workers[i] = worker;
}
- final long deadline = config.getTimeLimit() != null ? config.getTimeLimit().toMillis() : Long.MAX_VALUE;
+ final long deadline = config.getTimeLimit() != null ? config.getTimeLimit().toMilliseconds() : Long.MAX_VALUE;
final long startTime = System.currentTimeMillis();
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
index 2e9a81b..2ddce4f 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/SocksProxy.java
@@ -250,7 +250,7 @@ public void run() {
}
public void shutdown(final TimeValue timeout) throws InterruptedException {
- final long waitUntil = System.currentTimeMillis() + timeout.toMillis();
+ final long waitUntil = System.currentTimeMillis() + timeout.toMilliseconds();
Thread t = null;
synchronized (this) {
if (this.server != null) {
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
index 3b7af95..2c2a4d8 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/ClassicTestClient.java
@@ -89,7 +89,7 @@ public void start(final HttpProcessor httpProcessor) {
final StrictConnPool<HttpHost, HttpClientConnection> connPool = new StrictConnPool<>(
20,
50,
- TimeValue.NEG_ONE_MILLISECONDS,
+ TimeValue.NEG_ONE_MILLISECOND,
PoolReusePolicy.LIFO,
LoggingConnPoolListener.INSTANCE);
final HttpRequester requester = new HttpRequester(
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/BasicFuture.java b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/BasicFuture.java
index 11c892b..447d226 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/concurrent/BasicFuture.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/concurrent/BasicFuture.java
@@ -95,7 +95,7 @@ public synchronized T get(final long timeout, final TimeUnit unit)
if (this.completed) {
return getResult();
} else if (waitTime <= 0) {
- throw TimeoutValueException.fromMillis(msecs, msecs + Math.abs(waitTime));
+ throw TimeoutValueException.fromMilliseconds(msecs, msecs + Math.abs(waitTime));
} else {
for (;;) {
wait(waitTime);
@@ -104,7 +104,7 @@ public synchronized T get(final long timeout, final TimeUnit unit)
}
waitTime = msecs - (System.currentTimeMillis() - startTime);
if (waitTime <= 0) {
- throw TimeoutValueException.fromMillis(msecs, msecs + Math.abs(waitTime));
+ throw TimeoutValueException.fromMilliseconds(msecs, msecs + Math.abs(waitTime));
}
}
}
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
index f6d78d6..4e617d5 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/HttpRequester.java
@@ -249,7 +249,7 @@ private Socket createSocket(final HttpHost targetHost) throws IOException {
} else {
sock = new Socket();
}
- sock.setSoTimeout(socketConfig.getSoTimeout().toMillisIntBound());
+ sock.setSoTimeout(socketConfig.getSoTimeout().toMillisecondsIntBound());
sock.setReuseAddress(socketConfig.isSoReuseAddress());
sock.setTcpNoDelay(socketConfig.isTcpNoDelay());
sock.setKeepAlive(socketConfig.isSoKeepAlive());
@@ -259,7 +259,7 @@ private Socket createSocket(final HttpHost targetHost) throws IOException {
if (socketConfig.getSndBufSize() > 0) {
sock.setSendBufferSize(socketConfig.getSndBufSize());
}
- final int linger = socketConfig.getSoLinger().toMillisIntBound();
+ final int linger = socketConfig.getSoLinger().toMillisecondsIntBound();
if (linger >= 0) {
sock.setSoLinger(true, linger);
}
@@ -271,7 +271,7 @@ private Socket createSocket(final HttpHost targetHost) throws IOException {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws IOException {
- sock.connect(targetAddress, socketConfig.getSoTimeout().toMillisIntBound());
+ sock.connect(targetAddress, socketConfig.getSoTimeout().toMillisecondsIntBound());
return null;
}
});
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
index a0e9ee4..c09ce11 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/RequestListener.java
@@ -69,7 +69,7 @@ public void run() {
try {
while (!isTerminated() && !Thread.interrupted()) {
final Socket socket = this.serverSocket.accept();
- socket.setSoTimeout(this.socketConfig.getSoTimeout().toMillisIntBound());
+ socket.setSoTimeout(this.socketConfig.getSoTimeout().toMillisecondsIntBound());
socket.setKeepAlive(this.socketConfig.isSoKeepAlive());
socket.setTcpNoDelay(this.socketConfig.isTcpNoDelay());
if (this.socketConfig.getRcvBufSize() > 0) {
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 bf936d1..90619d0 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
@@ -197,7 +197,7 @@ public void setSocketTimeout(final Timeout timeout) {
final SocketHolder socketHolder = this.socketHolderRef.get();
if (socketHolder != null) {
try {
- socketHolder.getSocket().setSoTimeout(Timeout.defaultsToDisabled(timeout).toMillisIntBound());
+ socketHolder.getSocket().setSoTimeout(Timeout.defaultsToDisabled(timeout).toMillisecondsIntBound());
} catch (final SocketException ignore) {
// It is not quite clear from the Sun's documentation if there are any
// other legitimate cases for a socket exception to be thrown when setting
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
index 305ec14..20f23ee 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/io/SocketConfig.java
@@ -193,7 +193,7 @@ public static class Builder {
Builder() {
this.soTimeout = Timeout.ZERO_MILLISECONDS;
this.soReuseAddress = false;
- this.soLinger = TimeValue.NEG_ONE_SECONDS;
+ this.soLinger = TimeValue.NEG_ONE_SECOND;
this.soKeepAlive = false;
this.tcpNoDelay = true;
this.sndBufSize = 0;
@@ -350,7 +350,7 @@ public SocketConfig build() {
return new SocketConfig(
Timeout.defaultsToDisabled(soTimeout),
soReuseAddress,
- soLinger != null ? soLinger : TimeValue.NEG_ONE_SECONDS,
+ soLinger != null ? soLinger : TimeValue.NEG_ONE_SECOND,
soKeepAlive, tcpNoDelay, sndBufSize, rcvBufSize, backlogSize,
socksProxyAddress);
}
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
index 4594fe3..82d2119 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/LaxConnPool.java
@@ -109,7 +109,7 @@ public LaxConnPool(
}
public LaxConnPool(final int defaultMaxPerRoute) {
- this(defaultMaxPerRoute, TimeValue.NEG_ONE_MILLISECONDS, PoolReusePolicy.LIFO, null, null);
+ this(defaultMaxPerRoute, TimeValue.NEG_ONE_MILLISECOND, PoolReusePolicy.LIFO, null, null);
}
public boolean isShutdown() {
@@ -263,7 +263,7 @@ public void enumLeased(final Callback<PoolEntry<T, C>> callback) {
@Override
public void closeIdle(final TimeValue idleTime) {
- final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMillis() : 0);
+ final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMilliseconds() : 0);
enumAvailable(new Callback<PoolEntry<T, C>>() {
@Override
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
index c6422d3..19c2e36 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
@@ -123,7 +123,7 @@ public StrictConnPool(
}
public StrictConnPool(final int defaultMaxPerRoute, final int maxTotal) {
- this(defaultMaxPerRoute, maxTotal, TimeValue.NEG_ONE_MILLISECONDS, PoolReusePolicy.LIFO, null);
+ this(defaultMaxPerRoute, maxTotal, TimeValue.NEG_ONE_MILLISECOND, PoolReusePolicy.LIFO, null);
}
public boolean isShutdown() {
@@ -588,7 +588,7 @@ private void purgePoolMap() {
@Override
public void closeIdle(final TimeValue idleTime) {
- final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMillis() : 0);
+ final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMilliseconds() : 0);
enumAvailable(new Callback<PoolEntry<T, C>>() {
@Override
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessionPool.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessionPool.java
index 33528ac..08049be 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessionPool.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessionPool.java
@@ -261,7 +261,7 @@ public final void enumAvailable(final Callback<IOSession> callback) {
}
public final void closeIdle(final TimeValue idleTime) {
- final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMillis() : 0);
+ final long deadline = System.currentTimeMillis() - (TimeValue.isPositive(idleTime) ? idleTime.toMilliseconds() : 0);
for (final PoolEntry poolEntry: sessionPool.values()) {
if (poolEntry.session != null) {
synchronized (poolEntry) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractSingleCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractSingleCoreIOReactor.java
index 62db777..e58bada 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractSingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractSingleCoreIOReactor.java
@@ -116,8 +116,8 @@ public void execute() {
@Override
public final void awaitShutdown(final TimeValue waitTime) throws InterruptedException {
Args.notNull(waitTime, "Wait time");
- final long deadline = System.currentTimeMillis() + waitTime.toMillis();
- long remaining = waitTime.toMillis();
+ final long deadline = System.currentTimeMillis() + waitTime.toMilliseconds();
+ long remaining = waitTime.toMilliseconds();
synchronized (this.shutdownMutex) {
while (this.status.get().compareTo(IOReactorStatus.SHUT_DOWN) < 0) {
this.shutdownMutex.wait(remaining);
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
index d26014a..2f84aa5 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
@@ -251,7 +251,7 @@ public static void setDefaultMaxIoThreadCount(final int defaultMaxIoThreadCount)
this.ioThreadCount = Builder.getDefaultMaxIoThreadCount();
this.soTimeout = Timeout.ZERO_MILLISECONDS;
this.soReuseAddress = false;
- this.soLinger = TimeValue.NEG_ONE_SECONDS;
+ this.soLinger = TimeValue.NEG_ONE_SECOND;
this.soKeepAlive = false;
this.tcpNoDelay = true;
this.sndBufSize = 0;
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChannel.java
index ac2c2e7..fce58bd 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChannel.java
@@ -60,7 +60,7 @@ final void handleIOEvent(final int ops) {
final boolean checkTimeout(final long currentTimeMillis) {
final Timeout timeout = getTimeout();
if (!timeout.isDisabled()) {
- final long timeoutMillis = timeout.toMillis();
+ final long timeoutMillis = timeout.toMilliseconds();
final long deadlineMillis = getLastEventTime() + timeoutMillis;
if (currentTimeMillis > deadlineMillis) {
try {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/MultiCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/MultiCoreIOReactor.java
index d7ea658..48e4e7a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/MultiCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/MultiCoreIOReactor.java
@@ -81,8 +81,8 @@ public final void initiateShutdown() {
@Override
public final void awaitShutdown(final TimeValue waitTime) throws InterruptedException {
Args.notNull(waitTime, "Wait time");
- final long deadline = System.currentTimeMillis() + waitTime.toMillis();
- long remaining = waitTime.toMillis();
+ final long deadline = System.currentTimeMillis() + waitTime.toMilliseconds();
+ long remaining = waitTime.toMilliseconds();
for (int i = 0; i < this.ioReactors.length; i++) {
final IOReactor ioReactor = this.ioReactors[i];
if (ioReactor.getStatus().compareTo(IOReactorStatus.SHUT_DOWN) < 0) {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
index 43b3201..dea3bfa 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
@@ -88,7 +88,7 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
this.closedSessions = new ConcurrentLinkedQueue<>();
this.channelQueue = new ConcurrentLinkedQueue<>();
this.requestQueue = new ConcurrentLinkedQueue<>();
- this.selectTimeoutMillis = this.reactorConfig.getSelectInterval().toMillis();
+ this.selectTimeoutMillis = this.reactorConfig.getSelectInterval().toMilliseconds();
}
void enqueueChannel(final SocketChannel socketChannel) throws IOReactorShutdownException {
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
index 1b8577f..f70918c 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
@@ -69,7 +69,7 @@ class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implement
this.requestQueue = new ConcurrentLinkedQueue<>();
this.endpoints = new ConcurrentHashMap<>();
this.paused = new AtomicBoolean(false);
- this.selectTimeoutMillis = this.reactorConfig.getSelectInterval().toMillis();
+ this.selectTimeoutMillis = this.reactorConfig.getSelectInterval().toMilliseconds();
}
@Override
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/Deadline.java b/httpcore5/src/main/java/org/apache/hc/core5/util/Deadline.java
index 2a598a0..ad88bd2 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/Deadline.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/Deadline.java
@@ -78,8 +78,8 @@ public class Deadline {
public static Deadline calculate(final long timeMillis, final TimeValue timeValue) {
if (TimeValue.isPositive(timeValue)) {
// TODO handle unlikely overflow
- final long deadline = timeMillis + timeValue.toMillis();
- return deadline < 0 ? Deadline.MAX_VALUE : Deadline.fromUnixMillis(deadline);
+ final long deadline = timeMillis + timeValue.toMilliseconds();
+ return deadline < 0 ? Deadline.MAX_VALUE : Deadline.fromUnixMilliseconds(deadline);
}
return Deadline.MAX_VALUE;
}
@@ -101,7 +101,7 @@ public static Deadline calculate(final TimeValue timeValue) {
* @param value a UNIX time in milliseconds.
* @return a new deadline.
*/
- public static Deadline fromUnixMillis(final long value) {
+ public static Deadline fromUnixMilliseconds(final long value) {
if (value == INTERNAL_MAX_VALUE) {
return MAX_VALUE;
}
@@ -119,7 +119,7 @@ public static Deadline fromUnixMillis(final long value) {
* @throws ParseException if the specified source string cannot be parsed.
*/
public static Deadline parse(final String source) throws ParseException {
- return fromUnixMillis(simpleDateFormat.parse(source).getTime());
+ return fromUnixMilliseconds(simpleDateFormat.parse(source).getTime());
}
private volatile boolean frozen;
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
index 794e135..576d875 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
@@ -53,12 +53,12 @@ public class TimeValue implements Comparable<TimeValue> {
/**
* A negative one millisecond {@link TimeValue}.
*/
- public static final TimeValue NEG_ONE_MILLISECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.MILLISECONDS);
+ public static final TimeValue NEG_ONE_MILLISECOND = TimeValue.of(INT_UNDEFINED, TimeUnit.MILLISECONDS);
/**
* A negative one second {@link TimeValue}.
*/
- public static final TimeValue NEG_ONE_SECONDS = TimeValue.of(INT_UNDEFINED, TimeUnit.SECONDS);
+ public static final TimeValue NEG_ONE_SECOND = TimeValue.of(INT_UNDEFINED, TimeUnit.SECONDS);
/**
* A zero milliseconds {@link TimeValue}.
@@ -99,24 +99,24 @@ public static <T extends TimeValue> T defaultsTo(final T timeValue, final T defa
/**
* Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
- * {@link #NEG_ONE_SECONDS}.
+ * {@link #NEG_ONE_SECOND}.
*
* @param timeValue may be {@code null}
- * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+ * @return {@code timeValue} or {@link #NEG_ONE_SECOND}
*/
public static TimeValue defaultsToNegativeOneMillisecond(final TimeValue timeValue) {
- return defaultsTo(timeValue, NEG_ONE_MILLISECONDS);
+ return defaultsTo(timeValue, NEG_ONE_MILLISECOND);
}
/**
* Returns the given {@code timeValue} if it is not {@code null}, if {@code null} then returns
- * {@link #NEG_ONE_SECONDS}.
+ * {@link #NEG_ONE_SECOND}.
*
* @param timeValue may be {@code null}
- * @return {@code timeValue} or {@link #NEG_ONE_SECONDS}
+ * @return {@code timeValue} or {@link #NEG_ONE_SECOND}
*/
public static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue) {
- return defaultsTo(timeValue, NEG_ONE_SECONDS);
+ return defaultsTo(timeValue, NEG_ONE_SECOND);
}
/**
@@ -126,7 +126,7 @@ public static TimeValue defaultsToNegativeOneSecond(final TimeValue timeValue) {
* @param timeValue may be {@code null}
* @return {@code timeValue} or {@link #ZERO_MILLISECONDS}
*/
- public static TimeValue defaultsToZeroMillis(final TimeValue timeValue) {
+ public static TimeValue defaultsToZeroMilliseconds(final TimeValue timeValue) {
return defaultsTo(timeValue, ZERO_MILLISECONDS);
}
@@ -198,7 +198,8 @@ public static TimeValue parse(final String value) throws ParseException {
final Locale locale = Locale.ROOT;
final String split[] = value.trim().split("\\s+");
if (split.length < 2) {
- throw new IllegalArgumentException(String.format("Expected format for <Long><SPACE><TimeUnit>: ", value));
+ throw new IllegalArgumentException(
+ String.format("Expected format for <Long><SPACE><java.util.concurrent.TimeUnit>: %s", value));
}
final String clean0 = split[0].trim();
final String clean1 = split[1].trim().toUpperCase(Locale.ROOT);
@@ -339,23 +340,23 @@ public long toHours() {
return timeUnit.toHours(duration);
}
- public long toMicros() {
+ public long toMicroseconds() {
return timeUnit.toMicros(duration);
}
- public long toMillis() {
+ public long toMilliseconds() {
return timeUnit.toMillis(duration);
}
- public int toMillisIntBound() {
- return asBoundInt(toMillis());
+ public int toMillisecondsIntBound() {
+ return asBoundInt(toMilliseconds());
}
public long toMinutes() {
return timeUnit.toMinutes(duration);
}
- public long toNanos() {
+ public long toNanoseconds() {
return timeUnit.toNanos(duration);
}
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeoutValueException.java b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeoutValueException.java
index 0a280ce..f3d2605 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/util/TimeoutValueException.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/util/TimeoutValueException.java
@@ -45,7 +45,7 @@ public class TimeoutValueException extends TimeoutException {
* @param timeoutActual How long we actually waited in milliseconds.
* @return a new TimeoutValueException.
*/
- public static TimeoutValueException fromMillis(final long timeoutDeadline, final long timeoutActual) {
+ public static TimeoutValueException fromMilliseconds(final long timeoutDeadline, final long timeoutActual) {
return new TimeoutValueException(Timeout.ofMilliseconds(min0(timeoutDeadline)),
Timeout.ofMilliseconds(min0(timeoutActual)));
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
index dd563a5..ee0e369 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
@@ -263,8 +263,8 @@ public Boolean call() throws Exception {
final int localPort = serverSocket.getLocalPort();
try (final Socket clientSocket = clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals('H', inputStream.read());
Assert.assertEquals('i', inputStream.read());
@@ -309,8 +309,8 @@ public Boolean call() throws Exception {
});
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
}
}
@@ -364,8 +364,8 @@ public Boolean call() throws Exception {
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals('H', inputStream.read());
Assert.assertEquals('i', inputStream.read());
@@ -436,8 +436,8 @@ public Principal call() throws Exception {
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals('H', inputStream.read());
@@ -485,8 +485,8 @@ public Boolean call() throws Exception {
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals(-1, inputStream.read());
@@ -532,8 +532,8 @@ public Principal call() throws Exception {
});
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals('H', inputStream.read());
@@ -593,8 +593,8 @@ public Principal call() throws Exception {
});
final int localPort = serverSocket.getLocalPort();
try (final SSLSocket clientSocket = (SSLSocket) clientSslContext.getSocketFactory().createSocket()) {
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals('H', inputStream.read());
@@ -653,8 +653,8 @@ public Boolean call() throws Exception {
final Set<String> supportedClientProtocols = new LinkedHashSet<>(Arrays.asList(clientSocket.getSupportedProtocols()));
Assert.assertTrue(supportedClientProtocols.contains("SSLv3"));
clientSocket.setEnabledProtocols(new String[] {"SSLv3"} );
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
}
}
@@ -705,8 +705,8 @@ public Boolean call() throws Exception {
Arrays.asList(clientSocket.getSupportedProtocols()));
Assert.assertTrue(supportedClientProtocols.contains("TLSv1"));
clientSocket.setEnabledProtocols(new String[] { "TLSv1" });
- clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisIntBound());
- clientSocket.setSoTimeout(TIMEOUT.toMillisIntBound());
+ clientSocket.connect(new InetSocketAddress("localhost", localPort), TIMEOUT.toMillisecondsIntBound());
+ clientSocket.setSoTimeout(TIMEOUT.toMillisecondsIntBound());
clientSocket.startHandshake();
final InputStream inputStream = clientSocket.getInputStream();
Assert.assertEquals(-1, inputStream.read());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadline.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadline.java
index 7a5a9b5..6f0f0b7 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadline.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadline.java
@@ -39,7 +39,7 @@ public class TestDeadline {
@Test
public void testFormat() throws ParseException {
- final Deadline deadline = Deadline.fromUnixMillis(1000);
+ final Deadline deadline = Deadline.fromUnixMilliseconds(1000);
final Deadline deadline2 = Deadline.parse(deadline.toString());
Assert.assertEquals(1000, deadline2.getValue());
}
@@ -47,38 +47,38 @@ public void testFormat() throws ParseException {
@Test
public void testIsBefore() {
final long nowPlusOneMin = System.currentTimeMillis() + 60000;
- final Deadline deadline = Deadline.fromUnixMillis(nowPlusOneMin);
+ final Deadline deadline = Deadline.fromUnixMilliseconds(nowPlusOneMin);
Assert.assertTrue(deadline.isBefore(nowPlusOneMin + 1));
}
@Test
public void testIsExpired() {
- Assert.assertTrue(Deadline.fromUnixMillis(0).isExpired());
- Assert.assertTrue(Deadline.fromUnixMillis(1).isExpired());
+ Assert.assertTrue(Deadline.fromUnixMilliseconds(0).isExpired());
+ Assert.assertTrue(Deadline.fromUnixMilliseconds(1).isExpired());
Assert.assertFalse(Deadline.MAX_VALUE.isExpired());
Assert.assertTrue(Deadline.MIN_VALUE.isExpired());
}
@Test
public void testIsMax() {
- Assert.assertFalse(Deadline.fromUnixMillis(0).isMax());
- Assert.assertFalse(Deadline.fromUnixMillis(1000).isMax());
+ Assert.assertFalse(Deadline.fromUnixMilliseconds(0).isMax());
+ Assert.assertFalse(Deadline.fromUnixMilliseconds(1000).isMax());
Assert.assertFalse(Deadline.MIN_VALUE.isMax());
Assert.assertTrue(Deadline.MAX_VALUE.isMax());
}
@Test
public void testIsMin() {
- Assert.assertTrue(Deadline.fromUnixMillis(0).isMin());
- Assert.assertFalse(Deadline.fromUnixMillis(1000).isMin());
+ Assert.assertTrue(Deadline.fromUnixMilliseconds(0).isMin());
+ Assert.assertFalse(Deadline.fromUnixMilliseconds(1000).isMin());
Assert.assertFalse(Deadline.MAX_VALUE.isMin());
Assert.assertTrue(Deadline.MIN_VALUE.isMin());
}
@Test
public void testIsNotExpired() {
- Assert.assertFalse(Deadline.fromUnixMillis(0).isNotExpired());
- Assert.assertFalse(Deadline.fromUnixMillis(1).isNotExpired());
+ Assert.assertFalse(Deadline.fromUnixMilliseconds(0).isNotExpired());
+ Assert.assertFalse(Deadline.fromUnixMilliseconds(1).isNotExpired());
Assert.assertTrue(Deadline.MAX_VALUE.isNotExpired());
Assert.assertFalse(Deadline.MIN_VALUE.isNotExpired());
}
@@ -88,11 +88,11 @@ public void testMin() {
Assert.assertEquals(Deadline.MIN_VALUE, Deadline.MIN_VALUE.min(Deadline.MAX_VALUE));
Assert.assertEquals(Deadline.MIN_VALUE, Deadline.MAX_VALUE.min(Deadline.MIN_VALUE));
//
- final Deadline deadline0 = Deadline.fromUnixMillis(0);
+ final Deadline deadline0 = Deadline.fromUnixMilliseconds(0);
Assert.assertEquals(Deadline.MIN_VALUE, deadline0.min(Deadline.MIN_VALUE));
Assert.assertEquals(deadline0, deadline0.min(Deadline.MAX_VALUE));
//
- final Deadline deadline1 = Deadline.fromUnixMillis(0);
+ final Deadline deadline1 = Deadline.fromUnixMilliseconds(0);
Assert.assertEquals(Deadline.MIN_VALUE, deadline1.min(Deadline.MIN_VALUE));
Assert.assertEquals(deadline0, deadline1.min(Deadline.MAX_VALUE));
}
@@ -107,7 +107,7 @@ public void testParse() throws ParseException {
public void testRemaining() {
final int oneHourInMillis = 60_000 * 60;
final long nowPlusOneHour = System.currentTimeMillis() + oneHourInMillis;
- final Deadline deadline = Deadline.fromUnixMillis(nowPlusOneHour);
+ final Deadline deadline = Deadline.fromUnixMilliseconds(nowPlusOneHour);
Assert.assertEquals(nowPlusOneHour, deadline.getValue());
Assert.assertTrue(deadline.remaining() > 0);
Assert.assertTrue(deadline.remaining() <= oneHourInMillis);
@@ -117,17 +117,17 @@ public void testRemaining() {
public void testRemainingTimeValue() {
final int oneHourInMillis = 60_000 * 60;
final long nowPlusOneHour = System.currentTimeMillis() + oneHourInMillis;
- final Deadline deadline = Deadline.fromUnixMillis(nowPlusOneHour);
+ final Deadline deadline = Deadline.fromUnixMilliseconds(nowPlusOneHour);
Assert.assertEquals(nowPlusOneHour, deadline.getValue());
- Assert.assertTrue(deadline.remainingTimeValue().toNanos() > 0);
- Assert.assertTrue(deadline.remainingTimeValue().toMicros() > 0);
- Assert.assertTrue(deadline.remainingTimeValue().toMillis() > 0);
+ Assert.assertTrue(deadline.remainingTimeValue().toNanoseconds() > 0);
+ Assert.assertTrue(deadline.remainingTimeValue().toMicroseconds() > 0);
+ Assert.assertTrue(deadline.remainingTimeValue().toMilliseconds() > 0);
}
@Test
public void testValue() {
final long nowPlusOneMin = System.currentTimeMillis() + 60000;
- final Deadline deadline = Deadline.fromUnixMillis(nowPlusOneMin);
+ final Deadline deadline = Deadline.fromUnixMilliseconds(nowPlusOneMin);
Assert.assertEquals(nowPlusOneMin, deadline.getValue());
}
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadlineTimeoutException.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadlineTimeoutException.java
index 5ecd3a5..67ab6b8 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadlineTimeoutException.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestDeadlineTimeoutException.java
@@ -34,7 +34,7 @@ public class TestDeadlineTimeoutException {
@Test
public void testMessage() {
- final Deadline deadline = Deadline.fromUnixMillis(1000).freeze();
+ final Deadline deadline = Deadline.fromUnixMilliseconds(1000).freeze();
Assert.assertTrue(deadline.toString(), deadline.isExpired());
final String format = deadline.formatTarget();
final TimeValue diff = TimeValue.ofMilliseconds(deadline.remaining());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeValue.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeValue.java
index 4dcaf14..38c3b3f 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeValue.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeValue.java
@@ -44,20 +44,20 @@ private void checkToHours(final long value, final TimeUnit timeUnit) {
Assert.assertEquals(timeUnit.toHours(value), TimeValue.of(value, timeUnit).toHours());
}
- private void checkToMicros(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toMicros(value), TimeValue.of(value, timeUnit).toMicros());
+ private void checkToMicroseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toMicros(value), TimeValue.of(value, timeUnit).toMicroseconds());
}
- private void checkToMillis(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toMillis(value), TimeValue.of(value, timeUnit).toMillis());
+ private void checkToMilliseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toMillis(value), TimeValue.of(value, timeUnit).toMilliseconds());
}
private void checkToMinutes(final long value, final TimeUnit timeUnit) {
Assert.assertEquals(timeUnit.toMinutes(value), TimeValue.of(value, timeUnit).toMinutes());
}
- private void checkToNanos(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toNanos(value), TimeValue.of(value, timeUnit).toNanos());
+ private void checkToNanoseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toNanos(value), TimeValue.of(value, timeUnit).toNanoseconds());
}
private void checkToSeconds(final long value, final TimeUnit timeUnit) {
@@ -70,9 +70,9 @@ private void test(final long value) {
checkToHours(value, timeUnit);
checkToMinutes(value, timeUnit);
checkToSeconds(value, timeUnit);
- checkToMillis(value, timeUnit);
- checkToMicros(value, timeUnit);
- checkToNanos(value, timeUnit);
+ checkToMilliseconds(value, timeUnit);
+ checkToMicroseconds(value, timeUnit);
+ checkToNanoseconds(value, timeUnit);
}
}
@@ -97,18 +97,18 @@ public void testDivide() {
// nominator is 0, result should be 0.
Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toDays());
Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toHours());
- Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMicros());
- Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMillis());
+ Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMicroseconds());
+ Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMilliseconds());
Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMinutes());
- Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toNanos());
+ Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toNanoseconds());
Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toSeconds());
- Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMillisIntBound());
+ Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toMillisecondsIntBound());
Assert.assertEquals(0, TimeValue.ofMilliseconds(0).divide(2).toSecondsIntBound());
//
- Assert.assertEquals(50, TimeValue.ofMilliseconds(100).divide(2).toMillis());
+ Assert.assertEquals(50, TimeValue.ofMilliseconds(100).divide(2).toMilliseconds());
Assert.assertEquals(0, TimeValue.ofMinutes(1).divide(2).toSeconds());
Assert.assertEquals(30, TimeValue.ofMinutes(1).divide(2, TimeUnit.SECONDS).toSeconds());
- Assert.assertEquals(30000, TimeValue.ofMinutes(1).divide(2, TimeUnit.MILLISECONDS).toMillis());
+ Assert.assertEquals(30000, TimeValue.ofMinutes(1).divide(2, TimeUnit.MILLISECONDS).toMilliseconds());
}
@Test(expected = ArithmeticException.class)
@@ -136,7 +136,7 @@ public void testFactoryForMicroseconds() {
}
@Test
- public void testFactoryForMillisseconds() {
+ public void testFactoryForMilliseconds() {
testFactory(TimeUnit.MILLISECONDS);
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeout.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeout.java
index 336ff7b..a907c79 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeout.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeout.java
@@ -43,20 +43,20 @@ private void checkToHours(final long value, final TimeUnit timeUnit) {
Assert.assertEquals(timeUnit.toHours(value), Timeout.of(value, timeUnit).toHours());
}
- private void checkToMicros(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toMicros(value), Timeout.of(value, timeUnit).toMicros());
+ private void checkToMicroseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toMicros(value), Timeout.of(value, timeUnit).toMicroseconds());
}
- private void checkToMillis(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toMillis(value), Timeout.of(value, timeUnit).toMillis());
+ private void checkToMilliseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toMillis(value), Timeout.of(value, timeUnit).toMilliseconds());
}
private void checkToMinutes(final long value, final TimeUnit timeUnit) {
Assert.assertEquals(timeUnit.toMinutes(value), Timeout.of(value, timeUnit).toMinutes());
}
- private void checkToNanos(final long value, final TimeUnit timeUnit) {
- Assert.assertEquals(timeUnit.toNanos(value), Timeout.of(value, timeUnit).toNanos());
+ private void checkToNanoseconds(final long value, final TimeUnit timeUnit) {
+ Assert.assertEquals(timeUnit.toNanos(value), Timeout.of(value, timeUnit).toNanoseconds());
}
private void checkToSeconds(final long value, final TimeUnit timeUnit) {
@@ -69,9 +69,9 @@ private void test(final long value) {
checkToHours(value, timeUnit);
checkToMinutes(value, timeUnit);
checkToSeconds(value, timeUnit);
- checkToMillis(value, timeUnit);
- checkToMicros(value, timeUnit);
- checkToNanos(value, timeUnit);
+ checkToMilliseconds(value, timeUnit);
+ checkToMicroseconds(value, timeUnit);
+ checkToNanoseconds(value, timeUnit);
}
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeoutValueException.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeoutValueException.java
index 9683a99..265a649 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeoutValueException.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTimeoutValueException.java
@@ -35,6 +35,6 @@ public class TestTimeoutValueException {
@Test
public void testMessage() {
Assert.assertEquals("Timeout deadline: 1,000 MILLISECONDS, actual: 2,000 MILLISECONDS",
- TimeoutValueException.fromMillis(1000, 2000).getMessage());
+ TimeoutValueException.fromMilliseconds(1000, 2000).getMessage());
}
}