This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new aeec08f Pull down APR specific lock structure aeec08f is described below commit aeec08f36c3e8bc045c50f6f4d537e53b99e7cc4 Author: remm <r...@apache.org> AuthorDate: Mon Nov 25 23:40:23 2019 +0100 Pull down APR specific lock structure They would otherwise be allocated for NIOx but are not used at all. Port a472f6af67a7cc03fe42a55cfaa7902933117afd --- java/org/apache/tomcat/util/net/AprEndpoint.java | 20 ++++++++++++++++++ .../apache/tomcat/util/net/SocketWrapperBase.java | 24 ++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index d325b3c..927dd01 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -33,6 +33,7 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import javax.net.ssl.KeyManager; @@ -2096,10 +2097,21 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack { // This field should only be used by Poller#run() private int pollerFlags = 0; + /* + * Used if block/non-blocking is set at the socket level. The client is + * responsible for the thread-safe use of this field via the locks provided. + */ + private volatile boolean blockingStatus = true; + private final Lock blockingStatusReadLock; + private final WriteLock blockingStatusWriteLock; public AprSocketWrapper(Long socket, AprEndpoint endpoint) { super(socket, endpoint); + ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + this.blockingStatusReadLock = lock.readLock(); + this.blockingStatusWriteLock = lock.writeLock(); + // TODO Make the socketWriteBuffer size configurable and align the // SSL and app buffer size settings with NIO & NIO2. if (endpoint.isSSLEnabled()) { @@ -2112,6 +2124,14 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack { socketBufferHandler = new SocketBufferHandler(6 * 1500, 6 * 1500, true); } + public boolean getBlockingStatus() { return blockingStatus; } + public void setBlockingStatus(boolean blockingStatus) { + this.blockingStatus = blockingStatus; + } + public Lock getBlockingStatusReadLock() { return blockingStatusReadLock; } + public WriteLock getBlockingStatusWriteLock() { + return blockingStatusWriteLock; + } @Override public int read(boolean block, byte[] b, int off, int len) throws IOException { diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java b/java/org/apache/tomcat/util/net/SocketWrapperBase.java index 1470a6c..dd5e741 100644 --- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java +++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java @@ -28,9 +28,6 @@ import java.util.concurrent.Executor; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -65,14 +62,8 @@ public abstract class SocketWrapperBase<E> { protected String remoteAddr = null; protected String remoteHost = null; protected int remotePort = -1; - /* - * Used if block/non-blocking is set at the socket level. The client is - * responsible for the thread-safe use of this field via the locks provided. - */ - private volatile boolean blockingStatus = true; - private final Lock blockingStatusReadLock; - private final WriteLock blockingStatusWriteLock; - /* + + /** * Used to record the first IOException that occurs during non-blocking * read/writes that can't be usefully propagated up the stack since there is * no user code or appropriate container code in the stack to handle it. @@ -112,9 +103,6 @@ public abstract class SocketWrapperBase<E> { public SocketWrapperBase(E socket, AbstractEndpoint<E> endpoint) { this.socket = socket; this.endpoint = endpoint; - ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); - this.blockingStatusReadLock = lock.readLock(); - this.blockingStatusWriteLock = lock.writeLock(); if (endpoint.getUseAsyncIO() || needSemaphores()) { readPending = new Semaphore(1); writePending = new Semaphore(1); @@ -261,14 +249,6 @@ public abstract class SocketWrapperBase<E> { } protected abstract void populateLocalPort(); - public boolean getBlockingStatus() { return blockingStatus; } - public void setBlockingStatus(boolean blockingStatus) { - this.blockingStatus = blockingStatus; - } - public Lock getBlockingStatusReadLock() { return blockingStatusReadLock; } - public WriteLock getBlockingStatusWriteLock() { - return blockingStatusWriteLock; - } public SocketBufferHandler getSocketBufferHandler() { return socketBufferHandler; } public boolean hasDataToRead() { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org