private boolean nioIsBroken = false;
private Selector selector = null;
private int bufferSize = 8*1024;
+ private int packetSize = 8*1024;
private long requestCount=0;
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"
protected class SocketConnection implements ThreadPoolRunnable {
MsgContext ep;
- MsgAjp recv = new MsgAjp();
+ MsgAjp recv = new MsgAjp(packetSize);
boolean inProgress = false;
SocketConnection(MsgContext ep) {
private int linger=100;
private int socketTimeout;
private int bufferSize = -1;
+ private int packetSize = 8*1024;
private long requestCount=0;
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'.
*/
void processConnection(MsgContext ep) {
try {
- MsgAjp recv=new MsgAjp();
+ MsgAjp recv=new MsgAjp(packetSize);
while( running ) {
if(paused) { // Drop the connection on pause
break;
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;
/**
*/
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
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"
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() {