Author: markt
Date: Fri Aug 16 11:08:25 2013
New Revision: 1514655
URL: http://svn.apache.org/r1514655
Log:
Back-porting JSR-356
Need to be able to register sockets for read and/or write for the APR/native
Poller to implement non-blocking IO
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?rev=1514655&r1=1514654&r2=1514655&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Fri Aug
16 11:08:25 2013
@@ -136,7 +136,7 @@ public class AjpAprProtocol extends Abst
((AprEndpoint)proto.endpoint).getPoller().add(
socket.getSocket().longValue(),
proto.endpoint.getKeepAliveTimeout(),
- AprEndpoint.Poller.FLAGS_READ);
+ true, false);
}
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1514655&r1=1514654&r2=1514655&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
Fri Aug 16 11:08:25 2013
@@ -250,7 +250,7 @@ public class Http11AprProtocol extends A
((AprEndpoint)proto.endpoint).getPoller().add(
socket.getSocket().longValue(),
proto.endpoint.getKeepAliveTimeout(),
- AprEndpoint.Poller.FLAGS_READ);
+ true, false);
}
}
@@ -274,7 +274,7 @@ public class Http11AprProtocol extends A
((AprEndpoint) proto.endpoint).getCometPoller().add(
socket.getSocket().longValue(),
proto.endpoint.getSoTimeout(),
- AprEndpoint.Poller.FLAGS_READ);
+ true, false);
} else {
// Process a STOP directly
((AprEndpoint) proto.endpoint).processSocket(
@@ -286,7 +286,7 @@ public class Http11AprProtocol extends A
((AprEndpoint) proto.endpoint).getPoller().add(
socket.getSocket().longValue(),
processor.getUpgradeInbound().getReadTimeout(),
- AprEndpoint.Poller.FLAGS_READ);
+ true, false);
}
}
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1514655&r1=1514654&r2=1514655&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Fri
Aug 16 11:08:25 2013
@@ -1230,18 +1230,32 @@ public class AprEndpoint extends Abstrac
}
}
+
/**
* Add specified socket and associated pool to the poller. The socket
* will be added to a temporary array, and polled first after a maximum
* amount of time equal to pollTime (in most cases, latency will be
much
- * lower, however).
+ * lower, however). Note: If both read and write are false, the socket
+ * will only be checked for timeout; if the socket was already present
+ * in the poller, a callback event will be generated and the socket
will
+ * be removed from the poller.
*
- * @param socket to add to the poller
- * @param timeout read timeout (in milliseconds) to use with this
- * socket. Use -1 for infinite timeout
- * @param flags flags that define the events that are to be polled
- * for
+ * @param socket to add to the poller
+ * @param timeout to use for this connection
+ * @param read to do read polling
+ * @param write to do write polling
*/
+ public void add(long socket, int timeout, boolean read, boolean write)
{
+ add(socket, timeout,
+ (read ? Poll.APR_POLLIN : 0) |
+ (write ? Poll.APR_POLLOUT : 0));
+ }
+
+ /**
+ * @deprecated Use {@link #add(long, int, boolean, boolean)}. This
+ * method will be made private in Tomcat 8
+ */
+ @Deprecated
public void add(long socket, int timeout, int flags) {
synchronized (this) {
// Add socket to the list. Newly added sockets will wait
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]