You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2006/09/03 04:08:01 UTC
svn commit: r439700 - in /tomcat/connectors/trunk/jk/java/org/apache/jk:
common/ChannelNioSocket.java common/ChannelSocket.java common/MsgAjp.java
mbeans-descriptors.xml server/JkMain.java
Author: billbarker
Date: Sat Sep 2 19:08:00 2006
New Revision: 439700
URL: http://svn.apache.org/viewvc?rev=439700&view=rev
Log:
Add a packetSize option to match Mladen's option on the native side
Modified:
tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelNioSocket.java
tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelSocket.java
tomcat/connectors/trunk/jk/java/org/apache/jk/common/MsgAjp.java
tomcat/connectors/trunk/jk/java/org/apache/jk/mbeans-descriptors.xml
tomcat/connectors/trunk/jk/java/org/apache/jk/server/JkMain.java
Modified: tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelNioSocket.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelNioSocket.java?rev=439700&r1=439699&r2=439700&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelNioSocket.java (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelNioSocket.java Sat Sep 2 19:08:00 2006
@@ -98,6 +98,7 @@
private boolean nioIsBroken = false;
private Selector selector = null;
private int bufferSize = 8*1024;
+ private int packetSize = 8*1024;
private long requestCount=0;
@@ -159,6 +160,16 @@
return bufferSize;
}
+ public void setPacketSize(int ps) {
+ if(ps < 8*1024) {
+ ps = 8*1024;
+ }
+ packetSize = ps;
+ }
+
+ public int getPacketSize() {
+ return packetSize;
+ }
/**
* jmx:managed-attribute description="Bind on a specified address" access="READ_WRITE"
@@ -791,7 +802,7 @@
protected class SocketConnection implements ThreadPoolRunnable {
MsgContext ep;
- MsgAjp recv = new MsgAjp();
+ MsgAjp recv = new MsgAjp(packetSize);
boolean inProgress = false;
SocketConnection(MsgContext ep) {
Modified: tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelSocket.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelSocket.java?rev=439700&r1=439699&r2=439700&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelSocket.java (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/jk/common/ChannelSocket.java Sat Sep 2 19:08:00 2006
@@ -87,6 +87,8 @@
private int linger=100;
private int socketTimeout;
private int bufferSize = -1;
+ private int packetSize = 8*1024;
+
private long requestCount=0;
@@ -204,6 +206,17 @@
return bufferSize;
}
+ public void setPacketSize(int ps) {
+ if(ps < 8*1024) {
+ ps = 8*1024;
+ }
+ packetSize = ps;
+ }
+
+ public int getPacketSize() {
+ return packetSize;
+ }
+
/** At startup we'll look for the first free port in the range.
The difference between this port and the beggining of the range
is the 'id'.
@@ -664,7 +677,7 @@
*/
void processConnection(MsgContext ep) {
try {
- MsgAjp recv=new MsgAjp();
+ MsgAjp recv=new MsgAjp(packetSize);
while( running ) {
if(paused) { // Drop the connection on pause
break;
Modified: tomcat/connectors/trunk/jk/java/org/apache/jk/common/MsgAjp.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/jk/common/MsgAjp.java?rev=439700&r1=439699&r2=439700&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/jk/common/MsgAjp.java (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/jk/common/MsgAjp.java Sat Sep 2 19:08:00 2006
@@ -42,7 +42,7 @@
org.apache.commons.logging.LogFactory.getLog( MsgAjp.class );
// that's the original buffer size in ajp13 - otherwise we'll get interoperability problems.
- private byte buf[]=new byte[8*1024];
+ private byte buf[];
// The current read or write position in the buffer
private int pos;
/**
@@ -53,9 +53,31 @@
*/
private int len;
+ /**
+ * The maximum packet size
+ */
+ private int bufsize;
+ /**
+ * Constructor that takes a buffer size
+ */
+ public MsgAjp(int bsize) {
+ if(bsize < 8*1024) {
+ bsize = 8*1024;
+ }
+ bufsize = bsize;
+ buf = new byte[bsize];
-
+ }
+
+ /**
+ * No arg constructor.
+ * @deprecated Use the buffer size constructor.
+ */
+ public MsgAjp() {
+ this(8*1024);
+ }
+
/**
* Prepare this packet for accumulating a message from the container to
* the web server. Set the write position to just after the header
Modified: tomcat/connectors/trunk/jk/java/org/apache/jk/mbeans-descriptors.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/jk/mbeans-descriptors.xml?rev=439700&r1=439699&r2=439700&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/jk/mbeans-descriptors.xml (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/jk/mbeans-descriptors.xml Sat Sep 2 19:08:00 2006
@@ -50,6 +50,9 @@
description="are worker threads on daemon mode"
type="boolean"
writeable="false"/>
+ <attribute name="packetSize"
+ description="The maximum AJP packet size"
+ type="int" />
<operation name="start"
description="Start, if server socket no create call init"
Modified: tomcat/connectors/trunk/jk/java/org/apache/jk/server/JkMain.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/java/org/apache/jk/server/JkMain.java?rev=439700&r1=439699&r2=439700&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/java/org/apache/jk/server/JkMain.java (original)
+++ tomcat/connectors/trunk/jk/java/org/apache/jk/server/JkMain.java Sat Sep 2 19:08:00 2006
@@ -488,6 +488,7 @@
replacements.put("address", "channelSocket.address");
replacements.put("bufferSize", "channelSocket.bufferSize");
replacements.put("tomcatAuthentication", "request.tomcatAuthentication");
+ replacements.put("packetSize", "channelSocket.packetSize");
}
private void preProcessProperties() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org