Author: jfclere Date: Mon Oct 23 02:15:22 2006 New Revision: 466958 URL: http://svn.apache.org/viewvc?view=rev&rev=466958 Log: Add a packetSize option to match the option on the native side.
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelNioSocket.java tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelSocket.java tomcat/tc6.0.x/trunk/java/org/apache/jk/common/MsgAjp.java tomcat/tc6.0.x/trunk/java/org/apache/jk/mbeans-descriptors.xml tomcat/tc6.0.x/trunk/java/org/apache/jk/server/JkMain.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelNioSocket.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelNioSocket.java?view=diff&rev=466958&r1=466957&r2=466958 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelNioSocket.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelNioSocket.java Mon Oct 23 02:15:22 2006 @@ -99,6 +99,7 @@ private boolean nioIsBroken = false; private Selector selector = null; private int bufferSize = 8*1024; + private int packetSize = 8*1024; private long requestCount=0; @@ -160,6 +161,17 @@ 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" @@ -792,7 +804,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/tc6.0.x/trunk/java/org/apache/jk/common/ChannelSocket.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelSocket.java?view=diff&rev=466958&r1=466957&r2=466958 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelSocket.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jk/common/ChannelSocket.java Mon Oct 23 02:15:22 2006 @@ -88,6 +88,7 @@ private int linger=100; private int socketTimeout; private int bufferSize = -1; + private int packetSize = 8*1024; private long requestCount=0; @@ -205,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'. @@ -665,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/tc6.0.x/trunk/java/org/apache/jk/common/MsgAjp.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jk/common/MsgAjp.java?view=diff&rev=466958&r1=466957&r2=466958 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jk/common/MsgAjp.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jk/common/MsgAjp.java Mon Oct 23 02:15:22 2006 @@ -43,7 +43,7 @@ org.apache.juli.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; /** @@ -54,9 +54,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/tc6.0.x/trunk/java/org/apache/jk/mbeans-descriptors.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jk/mbeans-descriptors.xml?view=diff&rev=466958&r1=466957&r2=466958 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jk/mbeans-descriptors.xml (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jk/mbeans-descriptors.xml Mon Oct 23 02:15:22 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/tc6.0.x/trunk/java/org/apache/jk/server/JkMain.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jk/server/JkMain.java?view=diff&rev=466958&r1=466957&r2=466958 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jk/server/JkMain.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jk/server/JkMain.java Mon Oct 23 02:15:22 2006 @@ -488,7 +488,8 @@ replacements.put("timeout", "channelSocket.timeout"); replacements.put("address", "channelSocket.address"); replacements.put("bufferSize", "channelSocket.bufferSize"); - replacements.put("tomcatAuthentication", "request.tomcatAuthentication"); + replacements.put("tomcatAuthentication", "request.tomcatAuthentication"); + replacements.put("packetSize", "channelSocket.packetSize"); } private void preProcessProperties() { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]