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 2018/08/05 16:34:37 UTC
httpcomponents-core git commit: Refactor timeout APIs to include the
scale in the method name;
for example 'int getSocketTimeout()' vs. int 'getSocketTimeoutMillis()'.
[Forced Update!]
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 5299ecd4f -> fe0e45ccd (forced update)
Refactor timeout APIs to include the scale in the method name; for
example 'int getSocketTimeout()' vs. int 'getSocketTimeoutMillis()'.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/fe0e45cc
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/fe0e45cc
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/fe0e45cc
Branch: refs/heads/master
Commit: fe0e45ccd99078cf9f5edd4ce76268a4f6445428
Parents: 8051de5
Author: Gary Gregory <gg...@apache.org>
Authored: Sun Aug 5 10:14:21 2018 -0600
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Sun Aug 5 18:33:24 2018 +0200
----------------------------------------------------------------------
.../hc/core5/http2/nio/pool/H2ConnPool.java | 2 +-
.../hc/core5/testing/nio/LoggingIOSession.java | 4 ++--
.../hc/core5/reactor/AbstractIOSessionPool.java | 2 +-
.../hc/core5/reactor/IOReactorConfig.java | 24 ++++++++++----------
.../org/apache/hc/core5/reactor/IOSession.java | 2 +-
.../apache/hc/core5/reactor/IOSessionImpl.java | 2 +-
.../hc/core5/reactor/InternalChannel.java | 8 +++----
.../core5/reactor/InternalConnectChannel.java | 8 +++----
.../hc/core5/reactor/InternalDataChannel.java | 4 ++--
.../hc/core5/reactor/SingleCoreIOReactor.java | 18 +++++++--------
.../reactor/SingleCoreListeningIOReactor.java | 4 ++--
.../hc/core5/reactor/ssl/SSLIOSession.java | 4 ++--
12 files changed, 41 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
----------------------------------------------------------------------
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 a18552f..1673a4b 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
@@ -135,7 +135,7 @@ public final class H2ConnPool extends AbstractIOSessionPool<HttpHost> {
final Callback<Boolean> callback) {
final TimeValue timeValue = validateAfterInactivity;
if (TimeValue.isPositive(timeValue)) {
- final long lastAccessTime = Math.min(ioSession.getLastReadTime(), ioSession.getLastWriteTime());
+ final long lastAccessTime = Math.min(ioSession.getLastReadTimeMillis(), ioSession.getLastWriteTime());
final long deadline = lastAccessTime + timeValue.toMillis();
if (deadline <= System.currentTimeMillis()) {
final int socketTimeoutMillis = ioSession.getSocketTimeoutMillis();
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
index 43e5ebc..40a977d 100644
--- a/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
+++ b/httpcore5-testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSession.java
@@ -200,8 +200,8 @@ public class LoggingIOSession implements IOSession {
}
@Override
- public long getLastReadTime() {
- return this.session.getLastReadTime();
+ public long getLastReadTimeMillis() {
+ return this.session.getLastReadTimeMillis();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessionPool.java
----------------------------------------------------------------------
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 479fda2..7e15024 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
@@ -264,7 +264,7 @@ public abstract class AbstractIOSessionPool<T> implements ModalCloseable {
for (final PoolEntry poolEntry: sessionPool.values()) {
if (poolEntry.session != null) {
synchronized (poolEntry) {
- if (poolEntry.session != null && poolEntry.session.getLastReadTime() <= deadline) {
+ if (poolEntry.session != null && poolEntry.session.getLastReadTimeMillis() <= deadline) {
closeSession(poolEntry.session, CloseMode.GRACEFUL);
poolEntry.session = null;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConfig.java
----------------------------------------------------------------------
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 9915e2e..b89b8e4 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
@@ -45,7 +45,7 @@ public final class IOReactorConfig {
public static final IOReactorConfig DEFAULT = new Builder().build();
- private final long selectInterval;
+ private final long selectIntervalMillis;
private final int ioThreadCount;
private final Timeout soTimeout;
private final boolean soReuseAddress;
@@ -57,7 +57,7 @@ public final class IOReactorConfig {
private final int backlogSize;
IOReactorConfig(
- final long selectInterval,
+ final long selectIntervalMillis,
final int ioThreadCount,
final Timeout soTimeout,
final boolean soReuseAddress,
@@ -68,7 +68,7 @@ public final class IOReactorConfig {
final int rcvBufSize,
final int backlogSize) {
super();
- this.selectInterval = selectInterval;
+ this.selectIntervalMillis = selectIntervalMillis;
this.ioThreadCount = Args.positive(ioThreadCount, "ioThreadCount");
this.soTimeout = soTimeout;
this.soReuseAddress = soReuseAddress;
@@ -87,8 +87,8 @@ public final class IOReactorConfig {
* Default: {@code 1000} milliseconds.
* </p>
*/
- public long getSelectInterval() {
- return this.selectInterval;
+ public long getSelectIntervalMillis() {
+ return this.selectIntervalMillis;
}
/**
@@ -210,7 +210,7 @@ public final class IOReactorConfig {
public static Builder copy(final IOReactorConfig config) {
Args.notNull(config, "I/O reactor config");
return new Builder()
- .setSelectInterval(config.getSelectInterval())
+ .setSelectIntervalMillis(config.getSelectIntervalMillis())
.setIoThreadCount(config.getIoThreadCount())
.setSoTimeout(config.getSoTimeout())
.setSoReuseAddress(config.isSoReuseAddress())
@@ -251,7 +251,7 @@ public final class IOReactorConfig {
DefaultMaxIoThreadCount = defaultMaxIoThreadCount;
}
- private long selectInterval;
+ private long selectIntervalMillis;
private int ioThreadCount;
private Timeout soTimeout;
private boolean soReuseAddress;
@@ -263,7 +263,7 @@ public final class IOReactorConfig {
private int backlogSize;
Builder() {
- this.selectInterval = 1000;
+ this.selectIntervalMillis = 1000;
this.ioThreadCount = Builder.getDefaultMaxIoThreadCount();
this.soTimeout = Timeout.ZERO_MILLISECONDS;
this.soReuseAddress = false;
@@ -275,8 +275,8 @@ public final class IOReactorConfig {
this.backlogSize = 0;
}
- public Builder setSelectInterval(final long selectInterval) {
- this.selectInterval = selectInterval;
+ public Builder setSelectIntervalMillis(final long selectIntervalMillis) {
+ this.selectIntervalMillis = selectIntervalMillis;
return this;
}
@@ -337,7 +337,7 @@ public final class IOReactorConfig {
public IOReactorConfig build() {
return new IOReactorConfig(
- selectInterval, ioThreadCount,
+ selectIntervalMillis, ioThreadCount,
Timeout.defaultsToDisabled(soTimeout),
soReuseAddress,
TimeValue.defaultsToNegativeOneMillisecond(soLinger),
@@ -351,7 +351,7 @@ public final class IOReactorConfig {
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
- builder.append("[selectInterval=").append(this.selectInterval)
+ builder.append("[selectIntervalMillis=").append(this.selectIntervalMillis)
.append(", ioThreadCount=").append(this.ioThreadCount)
.append(", soTimeout=").append(this.soTimeout)
.append(", soReuseAddress=").append(this.soReuseAddress)
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
index 01ce0ac..1b992ee 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
@@ -187,7 +187,7 @@ public interface IOSession extends ModalCloseable, Identifiable {
*
* @return timestamp.
*/
- long getLastReadTime();
+ long getLastReadTimeMillis();
/**
* Returns timestamp of the last write event.
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
index 150aa90..c252e46 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
@@ -185,7 +185,7 @@ class IOSessionImpl implements IOSession {
}
@Override
- public long getLastReadTime() {
+ public long getLastReadTimeMillis() {
return lastReadTime;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChannel.java
----------------------------------------------------------------------
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 22cbc7f..6c5e364 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
@@ -43,7 +43,7 @@ abstract class InternalChannel implements ModalCloseable {
abstract int getTimeoutMillis();
- abstract long getLastReadTime();
+ abstract long getLastReadTimeMillis();
final void handleIOEvent(final int ops) {
try {
@@ -56,11 +56,11 @@ abstract class InternalChannel implements ModalCloseable {
}
}
- final boolean checkTimeout(final long currentTime) {
+ final boolean checkTimeout(final long currentTimeMillis) {
final int timeoutMillis = getTimeoutMillis();
if (timeoutMillis > 0) {
- final long deadline = getLastReadTime() + timeoutMillis;
- if (currentTime > deadline) {
+ final long deadlineMillils = getLastReadTimeMillis() + timeoutMillis;
+ if (currentTimeMillis > deadlineMillils) {
try {
onTimeout(timeoutMillis);
} catch (final CancelledKeyException ex) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
index aad934d..74987ec 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
@@ -40,7 +40,7 @@ final class InternalConnectChannel extends InternalChannel {
private final SelectionKey key;
private final SocketChannel socketChannel;
private final IOSessionRequest sessionRequest;
- private final long creationTime;
+ private final long creationTimeMillis;
private final InternalDataChannelFactory dataChannelFactory;
InternalConnectChannel(
@@ -52,7 +52,7 @@ final class InternalConnectChannel extends InternalChannel {
this.key = key;
this.socketChannel = socketChannel;
this.sessionRequest = sessionRequest;
- this.creationTime = System.currentTimeMillis();
+ this.creationTimeMillis = System.currentTimeMillis();
this.dataChannelFactory = dataChannelFactory;
}
@@ -83,8 +83,8 @@ final class InternalConnectChannel extends InternalChannel {
}
@Override
- long getLastReadTime() {
- return creationTime;
+ long getLastReadTimeMillis() {
+ return creationTimeMillis;
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
index 19f957b..76882ad 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataChannel.java
@@ -365,8 +365,8 @@ final class InternalDataChannel extends InternalChannel implements ProtocolIOSes
}
@Override
- public long getLastReadTime() {
- return ioSession.getLastReadTime();
+ public long getLastReadTimeMillis() {
+ return ioSession.getLastReadTimeMillis();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
----------------------------------------------------------------------
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 67f38b4..c2066f3 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
@@ -65,7 +65,7 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
private final Queue<IOSessionRequest> requestQueue;
private final AtomicBoolean shutdownInitiated;
- private volatile long lastTimeoutCheck;
+ private volatile long lastTimeoutCheckMillis;
SingleCoreIOReactor(
final Queue<ExceptionEvent> auditLog,
@@ -104,10 +104,10 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
@Override
void doExecute() throws IOException {
- final long selectTimeout = this.reactorConfig.getSelectInterval();
+ final long selectTimeoutMillis = this.reactorConfig.getSelectIntervalMillis();
while (!Thread.currentThread().isInterrupted()) {
- final int readyCount = this.selector.select(selectTimeout);
+ final int readyCount = this.selector.select(selectTimeoutMillis);
if (getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) {
if (this.shutdownInitiated.compareAndSet(false, true)) {
@@ -158,11 +158,11 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
}
private void validateActiveChannels() {
- final long currentTime = System.currentTimeMillis();
- if( (currentTime - this.lastTimeoutCheck) >= this.reactorConfig.getSelectInterval()) {
- this.lastTimeoutCheck = currentTime;
+ final long currentTimeMillis = System.currentTimeMillis();
+ if( (currentTimeMillis - this.lastTimeoutCheckMillis) >= this.reactorConfig.getSelectIntervalMillis()) {
+ this.lastTimeoutCheckMillis = currentTimeMillis;
for (final SelectionKey key : this.selector.keys()) {
- checkTimeout(key, currentTime);
+ checkTimeout(key, currentTimeMillis);
}
}
}
@@ -226,10 +226,10 @@ class SingleCoreIOReactor extends AbstractSingleCoreIOReactor implements Connect
}
}
- private void checkTimeout(final SelectionKey key, final long now) {
+ private void checkTimeout(final SelectionKey key, final long nowMillis) {
final InternalChannel channel = (InternalChannel) key.attachment();
if (channel != null) {
- channel.checkTimeout(now);
+ channel.checkTimeout(nowMillis);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
----------------------------------------------------------------------
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 748eaf5..6496712 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
@@ -80,13 +80,13 @@ class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implement
@Override
protected final void doExecute() throws IOException {
- final long selectTimeout = this.reactorConfig.getSelectInterval();
+ final long selectTimeoutMillis = this.reactorConfig.getSelectIntervalMillis();
while (!Thread.currentThread().isInterrupted()) {
if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0) {
break;
}
- final int readyCount = this.selector.select(selectTimeout);
+ final int readyCount = this.selector.select(selectTimeoutMillis);
if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0) {
break;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e45cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
index 9e828b5..ca879af 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
@@ -799,8 +799,8 @@ public class SSLIOSession implements IOSession {
}
@Override
- public long getLastReadTime() {
- return this.session.getLastReadTime();
+ public long getLastReadTimeMillis() {
+ return this.session.getLastReadTimeMillis();
}
@Override
Re: httpcomponents-core git commit: Refactor timeout APIs to
include the scale in the method name; for example 'int getSocketTimeout()'
vs. int 'getSocketTimeoutMillis()'. [Forced Update!]
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2018-08-05 at 16:34 +0000, olegk@apache.org wrote:
> Repository: httpcomponents-core
> Updated Branches:
> refs/heads/master 5299ecd4f -> fe0e45ccd (forced update)
>
Gary
If you have unfinished code or feature please do not push partial
implementation straight into the master.
Please consider using a separate feature branch and merging only after
having completed the whole thing.
Please.
Oleg
>
> Refactor timeout APIs to include the scale in the method name; for
> example 'int getSocketTimeout()' vs. int 'getSocketTimeoutMillis()'.
>
> Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/r
> epo
> Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/co
> mmit/fe0e45cc
> Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree
> /fe0e45cc
> Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff
> /fe0e45cc
>
> Branch: refs/heads/master
> Commit: fe0e45ccd99078cf9f5edd4ce76268a4f6445428
> Parents: 8051de5
> Author: Gary Gregory <gg...@apache.org>
> Authored: Sun Aug 5 10:14:21 2018 -0600
> Committer: Oleg Kalnichevski <ol...@apache.org>
> Committed: Sun Aug 5 18:33:24 2018 +0200
>
> -------------------------------------------------------------------
> ---
> .../hc/core5/http2/nio/pool/H2ConnPool.java | 2 +-
> .../hc/core5/testing/nio/LoggingIOSession.java | 4 ++--
> .../hc/core5/reactor/AbstractIOSessionPool.java | 2 +-
> .../hc/core5/reactor/IOReactorConfig.java | 24 ++++++++++-----
> -----
> .../org/apache/hc/core5/reactor/IOSession.java | 2 +-
> .../apache/hc/core5/reactor/IOSessionImpl.java | 2 +-
> .../hc/core5/reactor/InternalChannel.java | 8 +++----
> .../core5/reactor/InternalConnectChannel.java | 8 +++----
> .../hc/core5/reactor/InternalDataChannel.java | 4 ++--
> .../hc/core5/reactor/SingleCoreIOReactor.java | 18 +++++++--------
> .../reactor/SingleCoreListeningIOReactor.java | 4 ++--
> .../hc/core5/reactor/ssl/SSLIOSession.java | 4 ++--
> 12 files changed, 41 insertions(+), 41 deletions(-)
> -------------------------------------------------------------------
> ---
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
> -------------------------------------------------------------------
> ---
> 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 a18552f..1673a4b 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
> @@ -135,7 +135,7 @@ public final class H2ConnPool extends
> AbstractIOSessionPool<HttpHost> {
> final Callback<Boolean> callback) {
> final TimeValue timeValue = validateAfterInactivity;
> if (TimeValue.isPositive(timeValue)) {
> - final long lastAccessTime =
> Math.min(ioSession.getLastReadTime(), ioSession.getLastWriteTime());
> + final long lastAccessTime =
> Math.min(ioSession.getLastReadTimeMillis(),
> ioSession.getLastWriteTime());
> final long deadline = lastAccessTime +
> timeValue.toMillis();
> if (deadline <= System.currentTimeMillis()) {
> final int socketTimeoutMillis =
> ioSession.getSocketTimeoutMillis();
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> -------------------------------------------------------------------
> ---
> diff --git a/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java b/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> index 43e5ebc..40a977d 100644
> --- a/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> +++ b/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> @@ -200,8 +200,8 @@ public class LoggingIOSession implements
> IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> - return this.session.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return this.session.getLastReadTimeMillis();
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSes
> sionPool.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> index 479fda2..7e15024 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> @@ -264,7 +264,7 @@ public abstract class AbstractIOSessionPool<T>
> implements ModalCloseable {
> for (final PoolEntry poolEntry: sessionPool.values()) {
> if (poolEntry.session != null) {
> synchronized (poolEntry) {
> - if (poolEntry.session != null &&
> poolEntry.session.getLastReadTime() <= deadline) {
> + if (poolEntry.session != null &&
> poolEntry.session.getLastReadTimeMillis() <= deadline) {
> closeSession(poolEntry.session,
> CloseMode.GRACEFUL);
> poolEntry.session = null;
> }
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConf
> ig.java
> -------------------------------------------------------------------
> ---
> 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 9915e2e..b89b8e4 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
> @@ -45,7 +45,7 @@ public final class IOReactorConfig {
>
> public static final IOReactorConfig DEFAULT = new
> Builder().build();
>
> - private final long selectInterval;
> + private final long selectIntervalMillis;
> private final int ioThreadCount;
> private final Timeout soTimeout;
> private final boolean soReuseAddress;
> @@ -57,7 +57,7 @@ public final class IOReactorConfig {
> private final int backlogSize;
>
> IOReactorConfig(
> - final long selectInterval,
> + final long selectIntervalMillis,
> final int ioThreadCount,
> final Timeout soTimeout,
> final boolean soReuseAddress,
> @@ -68,7 +68,7 @@ public final class IOReactorConfig {
> final int rcvBufSize,
> final int backlogSize) {
> super();
> - this.selectInterval = selectInterval;
> + this.selectIntervalMillis = selectIntervalMillis;
> this.ioThreadCount = Args.positive(ioThreadCount,
> "ioThreadCount");
> this.soTimeout = soTimeout;
> this.soReuseAddress = soReuseAddress;
> @@ -87,8 +87,8 @@ public final class IOReactorConfig {
> * Default: {@code 1000} milliseconds.
> * </p>
> */
> - public long getSelectInterval() {
> - return this.selectInterval;
> + public long getSelectIntervalMillis() {
> + return this.selectIntervalMillis;
> }
>
> /**
> @@ -210,7 +210,7 @@ public final class IOReactorConfig {
> public static Builder copy(final IOReactorConfig config) {
> Args.notNull(config, "I/O reactor config");
> return new Builder()
> - .setSelectInterval(config.getSelectInterval())
> + .setSelectIntervalMillis(config.getSelectIntervalMillis(
> ))
> .setIoThreadCount(config.getIoThreadCount())
> .setSoTimeout(config.getSoTimeout())
> .setSoReuseAddress(config.isSoReuseAddress())
> @@ -251,7 +251,7 @@ public final class IOReactorConfig {
> DefaultMaxIoThreadCount = defaultMaxIoThreadCount;
> }
>
> - private long selectInterval;
> + private long selectIntervalMillis;
> private int ioThreadCount;
> private Timeout soTimeout;
> private boolean soReuseAddress;
> @@ -263,7 +263,7 @@ public final class IOReactorConfig {
> private int backlogSize;
>
> Builder() {
> - this.selectInterval = 1000;
> + this.selectIntervalMillis = 1000;
> this.ioThreadCount =
> Builder.getDefaultMaxIoThreadCount();
> this.soTimeout = Timeout.ZERO_MILLISECONDS;
> this.soReuseAddress = false;
> @@ -275,8 +275,8 @@ public final class IOReactorConfig {
> this.backlogSize = 0;
> }
>
> - public Builder setSelectInterval(final long selectInterval)
> {
> - this.selectInterval = selectInterval;
> + public Builder setSelectIntervalMillis(final long
> selectIntervalMillis) {
> + this.selectIntervalMillis = selectIntervalMillis;
> return this;
> }
>
> @@ -337,7 +337,7 @@ public final class IOReactorConfig {
>
> public IOReactorConfig build() {
> return new IOReactorConfig(
> - selectInterval, ioThreadCount,
> + selectIntervalMillis, ioThreadCount,
> Timeout.defaultsToDisabled(soTimeout),
> soReuseAddress,
> TimeValue.defaultsToNegativeOneMillisecond(soLin
> ger),
> @@ -351,7 +351,7 @@ public final class IOReactorConfig {
> @Override
> public String toString() {
> final StringBuilder builder = new StringBuilder();
> - builder.append("[selectInterval=").append(this.selectInterva
> l)
> + builder.append("[selectIntervalMillis=").append(this.selectI
> ntervalMillis)
> .append(",
> ioThreadCount=").append(this.ioThreadCount)
> .append(", soTimeout=").append(this.soTimeout)
> .append(",
> soReuseAddress=").append(this.soReuseAddress)
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.jav
> a
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> index 01ce0ac..1b992ee 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> @@ -187,7 +187,7 @@ public interface IOSession extends
> ModalCloseable, Identifiable {
> *
> * @return timestamp.
> */
> - long getLastReadTime();
> + long getLastReadTimeMillis();
>
> /**
> * Returns timestamp of the last write event.
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl
> .java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> index 150aa90..c252e46 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> @@ -185,7 +185,7 @@ class IOSessionImpl implements IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> + public long getLastReadTimeMillis() {
> return lastReadTime;
> }
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChann
> el.java
> -------------------------------------------------------------------
> ---
> 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 22cbc7f..6c5e364 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
> @@ -43,7 +43,7 @@ abstract class InternalChannel implements
> ModalCloseable {
>
> abstract int getTimeoutMillis();
>
> - abstract long getLastReadTime();
> + abstract long getLastReadTimeMillis();
>
> final void handleIOEvent(final int ops) {
> try {
> @@ -56,11 +56,11 @@ abstract class InternalChannel implements
> ModalCloseable {
> }
> }
>
> - final boolean checkTimeout(final long currentTime) {
> + final boolean checkTimeout(final long currentTimeMillis) {
> final int timeoutMillis = getTimeoutMillis();
> if (timeoutMillis > 0) {
> - final long deadline = getLastReadTime() + timeoutMillis;
> - if (currentTime > deadline) {
> + final long deadlineMillils = getLastReadTimeMillis() +
> timeoutMillis;
> + if (currentTimeMillis > deadlineMillils) {
> try {
> onTimeout(timeoutMillis);
> } catch (final CancelledKeyException ex) {
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConne
> ctChannel.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> index aad934d..74987ec 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> @@ -40,7 +40,7 @@ final class InternalConnectChannel extends
> InternalChannel {
> private final SelectionKey key;
> private final SocketChannel socketChannel;
> private final IOSessionRequest sessionRequest;
> - private final long creationTime;
> + private final long creationTimeMillis;
> private final InternalDataChannelFactory dataChannelFactory;
>
> InternalConnectChannel(
> @@ -52,7 +52,7 @@ final class InternalConnectChannel extends
> InternalChannel {
> this.key = key;
> this.socketChannel = socketChannel;
> this.sessionRequest = sessionRequest;
> - this.creationTime = System.currentTimeMillis();
> + this.creationTimeMillis = System.currentTimeMillis();
> this.dataChannelFactory = dataChannelFactory;
> }
>
> @@ -83,8 +83,8 @@ final class InternalConnectChannel extends
> InternalChannel {
> }
>
> @Override
> - long getLastReadTime() {
> - return creationTime;
> + long getLastReadTimeMillis() {
> + return creationTimeMillis;
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataC
> hannel.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> index 19f957b..76882ad 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> @@ -365,8 +365,8 @@ final class InternalDataChannel extends
> InternalChannel implements ProtocolIOSes
> }
>
> @Override
> - public long getLastReadTime() {
> - return ioSession.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return ioSession.getLastReadTimeMillis();
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOR
> eactor.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> index 67f38b4..c2066f3 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> @@ -65,7 +65,7 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> private final Queue<IOSessionRequest> requestQueue;
> private final AtomicBoolean shutdownInitiated;
>
> - private volatile long lastTimeoutCheck;
> + private volatile long lastTimeoutCheckMillis;
>
> SingleCoreIOReactor(
> final Queue<ExceptionEvent> auditLog,
> @@ -104,10 +104,10 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
>
> @Override
> void doExecute() throws IOException {
> - final long selectTimeout =
> this.reactorConfig.getSelectInterval();
> + final long selectTimeoutMillis =
> this.reactorConfig.getSelectIntervalMillis();
> while (!Thread.currentThread().isInterrupted()) {
>
> - final int readyCount =
> this.selector.select(selectTimeout);
> + final int readyCount =
> this.selector.select(selectTimeoutMillis);
>
> if (getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN)
> >= 0) {
> if (this.shutdownInitiated.compareAndSet(false,
> true)) {
> @@ -158,11 +158,11 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> }
>
> private void validateActiveChannels() {
> - final long currentTime = System.currentTimeMillis();
> - if( (currentTime - this.lastTimeoutCheck) >=
> this.reactorConfig.getSelectInterval()) {
> - this.lastTimeoutCheck = currentTime;
> + final long currentTimeMillis = System.currentTimeMillis();
> + if( (currentTimeMillis - this.lastTimeoutCheckMillis) >=
> this.reactorConfig.getSelectIntervalMillis()) {
> + this.lastTimeoutCheckMillis = currentTimeMillis;
> for (final SelectionKey key : this.selector.keys()) {
> - checkTimeout(key, currentTime);
> + checkTimeout(key, currentTimeMillis);
> }
> }
> }
> @@ -226,10 +226,10 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> }
> }
>
> - private void checkTimeout(final SelectionKey key, final long
> now) {
> + private void checkTimeout(final SelectionKey key, final long
> nowMillis) {
> final InternalChannel channel = (InternalChannel)
> key.attachment();
> if (channel != null) {
> - channel.checkTimeout(now);
> + channel.checkTimeout(nowMillis);
> }
> }
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreLis
> teningIOReactor.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> index 748eaf5..6496712 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> @@ -80,13 +80,13 @@ class SingleCoreListeningIOReactor extends
> AbstractSingleCoreIOReactor implement
>
> @Override
> protected final void doExecute() throws IOException {
> - final long selectTimeout =
> this.reactorConfig.getSelectInterval();
> + final long selectTimeoutMillis =
> this.reactorConfig.getSelectIntervalMillis();
> while (!Thread.currentThread().isInterrupted()) {
> if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0)
> {
> break;
> }
>
> - final int readyCount =
> this.selector.select(selectTimeout);
> + final int readyCount =
> this.selector.select(selectTimeoutMillis);
>
> if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0)
> {
> break;
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSess
> ion.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> index 9e828b5..ca879af 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> @@ -799,8 +799,8 @@ public class SSLIOSession implements IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> - return this.session.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return this.session.getLastReadTimeMillis();
> }
>
> @Override
>
Re: httpcomponents-core git commit: Refactor timeout APIs to
include the scale in the method name; for example 'int getSocketTimeout()'
vs. int 'getSocketTimeoutMillis()'. [Forced Update!]
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2018-08-05 at 16:34 +0000, olegk@apache.org wrote:
> Repository: httpcomponents-core
> Updated Branches:
> refs/heads/master 5299ecd4f -> fe0e45ccd (forced update)
>
Gary
If you have unfinished code or feature please do not push partial
implementation straight into the master.
Please consider using a separate feature branch and merging only after
having completed the whole thing.
Please.
Oleg
>
> Refactor timeout APIs to include the scale in the method name; for
> example 'int getSocketTimeout()' vs. int 'getSocketTimeoutMillis()'.
>
> Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/r
> epo
> Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/co
> mmit/fe0e45cc
> Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree
> /fe0e45cc
> Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff
> /fe0e45cc
>
> Branch: refs/heads/master
> Commit: fe0e45ccd99078cf9f5edd4ce76268a4f6445428
> Parents: 8051de5
> Author: Gary Gregory <gg...@apache.org>
> Authored: Sun Aug 5 10:14:21 2018 -0600
> Committer: Oleg Kalnichevski <ol...@apache.org>
> Committed: Sun Aug 5 18:33:24 2018 +0200
>
> -------------------------------------------------------------------
> ---
> .../hc/core5/http2/nio/pool/H2ConnPool.java | 2 +-
> .../hc/core5/testing/nio/LoggingIOSession.java | 4 ++--
> .../hc/core5/reactor/AbstractIOSessionPool.java | 2 +-
> .../hc/core5/reactor/IOReactorConfig.java | 24 ++++++++++-----
> -----
> .../org/apache/hc/core5/reactor/IOSession.java | 2 +-
> .../apache/hc/core5/reactor/IOSessionImpl.java | 2 +-
> .../hc/core5/reactor/InternalChannel.java | 8 +++----
> .../core5/reactor/InternalConnectChannel.java | 8 +++----
> .../hc/core5/reactor/InternalDataChannel.java | 4 ++--
> .../hc/core5/reactor/SingleCoreIOReactor.java | 18 +++++++--------
> .../reactor/SingleCoreListeningIOReactor.java | 4 ++--
> .../hc/core5/reactor/ssl/SSLIOSession.java | 4 ++--
> 12 files changed, 41 insertions(+), 41 deletions(-)
> -------------------------------------------------------------------
> ---
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5-
> h2/src/main/java/org/apache/hc/core5/http2/nio/pool/H2ConnPool.java
> -------------------------------------------------------------------
> ---
> 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 a18552f..1673a4b 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
> @@ -135,7 +135,7 @@ public final class H2ConnPool extends
> AbstractIOSessionPool<HttpHost> {
> final Callback<Boolean> callback) {
> final TimeValue timeValue = validateAfterInactivity;
> if (TimeValue.isPositive(timeValue)) {
> - final long lastAccessTime =
> Math.min(ioSession.getLastReadTime(), ioSession.getLastWriteTime());
> + final long lastAccessTime =
> Math.min(ioSession.getLastReadTimeMillis(),
> ioSession.getLastWriteTime());
> final long deadline = lastAccessTime +
> timeValue.toMillis();
> if (deadline <= System.currentTimeMillis()) {
> final int socketTimeoutMillis =
> ioSession.getSocketTimeoutMillis();
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> -------------------------------------------------------------------
> ---
> diff --git a/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java b/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> index 43e5ebc..40a977d 100644
> --- a/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> +++ b/httpcore5-
> testing/src/main/java/org/apache/hc/core5/testing/nio/LoggingIOSessio
> n.java
> @@ -200,8 +200,8 @@ public class LoggingIOSession implements
> IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> - return this.session.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return this.session.getLastReadTimeMillis();
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSes
> sionPool.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> index 479fda2..7e15024 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/AbstractIOSessi
> onPool.java
> @@ -264,7 +264,7 @@ public abstract class AbstractIOSessionPool<T>
> implements ModalCloseable {
> for (final PoolEntry poolEntry: sessionPool.values()) {
> if (poolEntry.session != null) {
> synchronized (poolEntry) {
> - if (poolEntry.session != null &&
> poolEntry.session.getLastReadTime() <= deadline) {
> + if (poolEntry.session != null &&
> poolEntry.session.getLastReadTimeMillis() <= deadline) {
> closeSession(poolEntry.session,
> CloseMode.GRACEFUL);
> poolEntry.session = null;
> }
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOReactorConf
> ig.java
> -------------------------------------------------------------------
> ---
> 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 9915e2e..b89b8e4 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
> @@ -45,7 +45,7 @@ public final class IOReactorConfig {
>
> public static final IOReactorConfig DEFAULT = new
> Builder().build();
>
> - private final long selectInterval;
> + private final long selectIntervalMillis;
> private final int ioThreadCount;
> private final Timeout soTimeout;
> private final boolean soReuseAddress;
> @@ -57,7 +57,7 @@ public final class IOReactorConfig {
> private final int backlogSize;
>
> IOReactorConfig(
> - final long selectInterval,
> + final long selectIntervalMillis,
> final int ioThreadCount,
> final Timeout soTimeout,
> final boolean soReuseAddress,
> @@ -68,7 +68,7 @@ public final class IOReactorConfig {
> final int rcvBufSize,
> final int backlogSize) {
> super();
> - this.selectInterval = selectInterval;
> + this.selectIntervalMillis = selectIntervalMillis;
> this.ioThreadCount = Args.positive(ioThreadCount,
> "ioThreadCount");
> this.soTimeout = soTimeout;
> this.soReuseAddress = soReuseAddress;
> @@ -87,8 +87,8 @@ public final class IOReactorConfig {
> * Default: {@code 1000} milliseconds.
> * </p>
> */
> - public long getSelectInterval() {
> - return this.selectInterval;
> + public long getSelectIntervalMillis() {
> + return this.selectIntervalMillis;
> }
>
> /**
> @@ -210,7 +210,7 @@ public final class IOReactorConfig {
> public static Builder copy(final IOReactorConfig config) {
> Args.notNull(config, "I/O reactor config");
> return new Builder()
> - .setSelectInterval(config.getSelectInterval())
> + .setSelectIntervalMillis(config.getSelectIntervalMillis(
> ))
> .setIoThreadCount(config.getIoThreadCount())
> .setSoTimeout(config.getSoTimeout())
> .setSoReuseAddress(config.isSoReuseAddress())
> @@ -251,7 +251,7 @@ public final class IOReactorConfig {
> DefaultMaxIoThreadCount = defaultMaxIoThreadCount;
> }
>
> - private long selectInterval;
> + private long selectIntervalMillis;
> private int ioThreadCount;
> private Timeout soTimeout;
> private boolean soReuseAddress;
> @@ -263,7 +263,7 @@ public final class IOReactorConfig {
> private int backlogSize;
>
> Builder() {
> - this.selectInterval = 1000;
> + this.selectIntervalMillis = 1000;
> this.ioThreadCount =
> Builder.getDefaultMaxIoThreadCount();
> this.soTimeout = Timeout.ZERO_MILLISECONDS;
> this.soReuseAddress = false;
> @@ -275,8 +275,8 @@ public final class IOReactorConfig {
> this.backlogSize = 0;
> }
>
> - public Builder setSelectInterval(final long selectInterval)
> {
> - this.selectInterval = selectInterval;
> + public Builder setSelectIntervalMillis(final long
> selectIntervalMillis) {
> + this.selectIntervalMillis = selectIntervalMillis;
> return this;
> }
>
> @@ -337,7 +337,7 @@ public final class IOReactorConfig {
>
> public IOReactorConfig build() {
> return new IOReactorConfig(
> - selectInterval, ioThreadCount,
> + selectIntervalMillis, ioThreadCount,
> Timeout.defaultsToDisabled(soTimeout),
> soReuseAddress,
> TimeValue.defaultsToNegativeOneMillisecond(soLin
> ger),
> @@ -351,7 +351,7 @@ public final class IOReactorConfig {
> @Override
> public String toString() {
> final StringBuilder builder = new StringBuilder();
> - builder.append("[selectInterval=").append(this.selectInterva
> l)
> + builder.append("[selectIntervalMillis=").append(this.selectI
> ntervalMillis)
> .append(",
> ioThreadCount=").append(this.ioThreadCount)
> .append(", soTimeout=").append(this.soTimeout)
> .append(",
> soReuseAddress=").append(this.soReuseAddress)
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.jav
> a
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> index 01ce0ac..1b992ee 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
> @@ -187,7 +187,7 @@ public interface IOSession extends
> ModalCloseable, Identifiable {
> *
> * @return timestamp.
> */
> - long getLastReadTime();
> + long getLastReadTimeMillis();
>
> /**
> * Returns timestamp of the last write event.
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl
> .java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> index 150aa90..c252e46 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.j
> ava
> @@ -185,7 +185,7 @@ class IOSessionImpl implements IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> + public long getLastReadTimeMillis() {
> return lastReadTime;
> }
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalChann
> el.java
> -------------------------------------------------------------------
> ---
> 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 22cbc7f..6c5e364 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
> @@ -43,7 +43,7 @@ abstract class InternalChannel implements
> ModalCloseable {
>
> abstract int getTimeoutMillis();
>
> - abstract long getLastReadTime();
> + abstract long getLastReadTimeMillis();
>
> final void handleIOEvent(final int ops) {
> try {
> @@ -56,11 +56,11 @@ abstract class InternalChannel implements
> ModalCloseable {
> }
> }
>
> - final boolean checkTimeout(final long currentTime) {
> + final boolean checkTimeout(final long currentTimeMillis) {
> final int timeoutMillis = getTimeoutMillis();
> if (timeoutMillis > 0) {
> - final long deadline = getLastReadTime() + timeoutMillis;
> - if (currentTime > deadline) {
> + final long deadlineMillils = getLastReadTimeMillis() +
> timeoutMillis;
> + if (currentTimeMillis > deadlineMillils) {
> try {
> onTimeout(timeoutMillis);
> } catch (final CancelledKeyException ex) {
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConne
> ctChannel.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> index aad934d..74987ec 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnect
> Channel.java
> @@ -40,7 +40,7 @@ final class InternalConnectChannel extends
> InternalChannel {
> private final SelectionKey key;
> private final SocketChannel socketChannel;
> private final IOSessionRequest sessionRequest;
> - private final long creationTime;
> + private final long creationTimeMillis;
> private final InternalDataChannelFactory dataChannelFactory;
>
> InternalConnectChannel(
> @@ -52,7 +52,7 @@ final class InternalConnectChannel extends
> InternalChannel {
> this.key = key;
> this.socketChannel = socketChannel;
> this.sessionRequest = sessionRequest;
> - this.creationTime = System.currentTimeMillis();
> + this.creationTimeMillis = System.currentTimeMillis();
> this.dataChannelFactory = dataChannelFactory;
> }
>
> @@ -83,8 +83,8 @@ final class InternalConnectChannel extends
> InternalChannel {
> }
>
> @Override
> - long getLastReadTime() {
> - return creationTime;
> + long getLastReadTimeMillis() {
> + return creationTimeMillis;
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataC
> hannel.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> index 19f957b..76882ad 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalDataCha
> nnel.java
> @@ -365,8 +365,8 @@ final class InternalDataChannel extends
> InternalChannel implements ProtocolIOSes
> }
>
> @Override
> - public long getLastReadTime() {
> - return ioSession.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return ioSession.getLastReadTimeMillis();
> }
>
> @Override
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOR
> eactor.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> index 67f38b4..c2066f3 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIORea
> ctor.java
> @@ -65,7 +65,7 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> private final Queue<IOSessionRequest> requestQueue;
> private final AtomicBoolean shutdownInitiated;
>
> - private volatile long lastTimeoutCheck;
> + private volatile long lastTimeoutCheckMillis;
>
> SingleCoreIOReactor(
> final Queue<ExceptionEvent> auditLog,
> @@ -104,10 +104,10 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
>
> @Override
> void doExecute() throws IOException {
> - final long selectTimeout =
> this.reactorConfig.getSelectInterval();
> + final long selectTimeoutMillis =
> this.reactorConfig.getSelectIntervalMillis();
> while (!Thread.currentThread().isInterrupted()) {
>
> - final int readyCount =
> this.selector.select(selectTimeout);
> + final int readyCount =
> this.selector.select(selectTimeoutMillis);
>
> if (getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN)
> >= 0) {
> if (this.shutdownInitiated.compareAndSet(false,
> true)) {
> @@ -158,11 +158,11 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> }
>
> private void validateActiveChannels() {
> - final long currentTime = System.currentTimeMillis();
> - if( (currentTime - this.lastTimeoutCheck) >=
> this.reactorConfig.getSelectInterval()) {
> - this.lastTimeoutCheck = currentTime;
> + final long currentTimeMillis = System.currentTimeMillis();
> + if( (currentTimeMillis - this.lastTimeoutCheckMillis) >=
> this.reactorConfig.getSelectIntervalMillis()) {
> + this.lastTimeoutCheckMillis = currentTimeMillis;
> for (final SelectionKey key : this.selector.keys()) {
> - checkTimeout(key, currentTime);
> + checkTimeout(key, currentTimeMillis);
> }
> }
> }
> @@ -226,10 +226,10 @@ class SingleCoreIOReactor extends
> AbstractSingleCoreIOReactor implements Connect
> }
> }
>
> - private void checkTimeout(final SelectionKey key, final long
> now) {
> + private void checkTimeout(final SelectionKey key, final long
> nowMillis) {
> final InternalChannel channel = (InternalChannel)
> key.attachment();
> if (channel != null) {
> - channel.checkTimeout(now);
> + channel.checkTimeout(nowMillis);
> }
> }
>
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreLis
> teningIOReactor.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> index 748eaf5..6496712 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListe
> ningIOReactor.java
> @@ -80,13 +80,13 @@ class SingleCoreListeningIOReactor extends
> AbstractSingleCoreIOReactor implement
>
> @Override
> protected final void doExecute() throws IOException {
> - final long selectTimeout =
> this.reactorConfig.getSelectInterval();
> + final long selectTimeoutMillis =
> this.reactorConfig.getSelectIntervalMillis();
> while (!Thread.currentThread().isInterrupted()) {
> if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0)
> {
> break;
> }
>
> - final int readyCount =
> this.selector.select(selectTimeout);
> + final int readyCount =
> this.selector.select(selectTimeoutMillis);
>
> if (getStatus().compareTo(IOReactorStatus.ACTIVE) != 0)
> {
> break;
>
> http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/fe0e4
> 5cc/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSess
> ion.java
> -------------------------------------------------------------------
> ---
> diff --git
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> index 9e828b5..ca879af 100644
> ---
> a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> +++
> b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSessio
> n.java
> @@ -799,8 +799,8 @@ public class SSLIOSession implements IOSession {
> }
>
> @Override
> - public long getLastReadTime() {
> - return this.session.getLastReadTime();
> + public long getLastReadTimeMillis() {
> + return this.session.getLastReadTimeMillis();
> }
>
> @Override
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org