Skip to content

Commit

Permalink
Align longPool in APR with NIO.
Browse files Browse the repository at this point in the history
It does mean Processors allocated to requests when the connector is shut down could end up being eligible for GC rather than being recycled but there should be no functional change.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1682030 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed May 27, 2015
1 parent 44831a2 commit 907e77a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 5 additions & 10 deletions java/org/apache/coyote/http11/Http11AprProtocol.java
Expand Up @@ -20,7 +20,6 @@
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.AprEndpoint.Poller;
import org.apache.tomcat.util.net.SocketWrapperBase;


Expand Down Expand Up @@ -108,19 +107,15 @@ public void release(SocketWrapperBase<Long> socket,

@Override
protected void longPoll(SocketWrapperBase<Long> socket, Processor processor) {

if (processor.isAsync()) {
// Async
socket.setAsync(true);
} else {
// Upgraded
Poller p = ((AprEndpoint) getProtocol().getEndpoint()).getPoller();
if (p == null) {
// Connector has been stopped
release(socket, processor, false);
} else {
socket.registerReadInterest();
}
// Either:
// - this is an upgraded connection
// - the request line/headers have not been completely
// read
socket.registerReadInterest();
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions java/org/apache/tomcat/util/net/AprEndpoint.java
Expand Up @@ -2683,8 +2683,10 @@ public void registerReadInterest() {
if (closed) {
return;
}
((AprEndpoint) getEndpoint()).getPoller().add(
getSocket().longValue(), getReadTimeout(), Poll.APR_POLLIN);
Poller p = ((AprEndpoint) getEndpoint()).getPoller();
if (p != null) {
p.add(getSocket().longValue(), getReadTimeout(), Poll.APR_POLLIN);
}
}
}

Expand Down

0 comments on commit 907e77a

Please sign in to comment.