[jboss-svn-commits] JBL Code SVN: r7313 - labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 2 02:15:51 EST 2006
Author: mladen.turk at jboss.com
Date: 2006-11-02 02:15:49 -0500 (Thu, 02 Nov 2006)
New Revision: 7313
Modified:
labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java
labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpMessage.java
labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/Constants.java
Log:
Backport explicit flushing.
Modified: labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java 2006-11-02 07:06:18 UTC (rev 7312)
+++ labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java 2006-11-02 07:15:49 UTC (rev 7313)
@@ -265,6 +265,10 @@
*/
protected static final byte[] endMessageArray;
+ /**
+ * Direct buffer used for sending explicit flush message.
+ */
+ protected static final ByteBuffer flushMessageBuffer;
// ----------------------------------------------------- Static Initializer
@@ -272,7 +276,7 @@
static {
// Set the get body message buffer
- AjpMessage getBodyMessage = new AjpMessage(128);
+ AjpMessage getBodyMessage = new AjpMessage(16);
getBodyMessage.reset();
getBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
getBodyMessage.appendInt(Constants.MAX_READ_SIZE);
@@ -283,7 +287,7 @@
getBodyMessage.getLen());
// Set the read body message buffer
- AjpMessage pongMessage = new AjpMessage(128);
+ AjpMessage pongMessage = new AjpMessage(16);
pongMessage.reset();
pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
pongMessage.end();
@@ -292,7 +296,7 @@
pongMessage.getLen());
// Allocate the end message array
- AjpMessage endMessage = new AjpMessage(128);
+ AjpMessage endMessage = new AjpMessage(16);
endMessage.reset();
endMessage.appendByte(Constants.JK_AJP13_END_RESPONSE);
endMessage.appendByte(1);
@@ -301,6 +305,18 @@
System.arraycopy(endMessage.getBuffer(), 0, endMessageArray, 0,
endMessage.getLen());
+ // Set the flush message buffer
+ AjpMessage flushMessage = new AjpMessage(16);
+ flushMessage.reset();
+ flushMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
+ flushMessage.appendInt(0);
+ flushMessage.appendByte(0);
+ flushMessage.end();
+ flushMessageBuffer =
+ ByteBuffer.allocateDirect(flushMessage.getLen());
+ flushMessageBuffer.put(flushMessage.getBuffer(), 0,
+ flushMessage.getLen());
+
}
@@ -513,6 +529,11 @@
try {
flush();
+ // Send explicit flush message
+ if (Socket.sendb(socket, flushMessageBuffer, 0,
+ flushMessageBuffer.position()) < 0) {
+ error = true;
+ }
} catch (IOException e) {
// Set error flag
error = true;
Modified: labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpMessage.java
===================================================================
--- labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpMessage.java 2006-11-02 07:06:18 UTC (rev 7312)
+++ labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/AjpMessage.java 2006-11-02 07:15:49 UTC (rev 7313)
@@ -1,10 +1,11 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
Modified: labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/Constants.java
===================================================================
--- labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/Constants.java 2006-11-02 07:06:18 UTC (rev 7312)
+++ labs/jbossweb/trunk/src/share/classes/org/apache/coyote/ajp/Constants.java 2006-11-02 07:15:49 UTC (rev 7313)
@@ -1,10 +1,11 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@@ -88,20 +89,28 @@
public static final byte SC_A_ARE_DONE = (byte)0xFF;
// Ajp13 specific - needs refactoring for the new model
+
/**
- * Maximum Total byte size for a AJP packet
+ * Default maximum total byte size for a AJP packet
*/
public static final int MAX_PACKET_SIZE = 8192;
/**
* Size of basic packet header
*/
public static final int H_SIZE = 4;
+
/**
- * Maximum size of data that can be sent in one packet
+ * Size of the header metadata
*/
- public static final int MAX_READ_SIZE = MAX_PACKET_SIZE - H_SIZE - 2;
- public static final int MAX_SEND_SIZE = MAX_PACKET_SIZE - H_SIZE - 4;
+ public static final int READ_HEAD_LEN = 6;
+ public static final int SEND_HEAD_LEN = 8;
+ /**
+ * Default maximum size of data that can be sent in one packet
+ */
+ public static final int MAX_READ_SIZE = MAX_PACKET_SIZE - READ_HEAD_LEN;
+ public static final int MAX_SEND_SIZE = MAX_PACKET_SIZE - SEND_HEAD_LEN;
+
// Translates integer codes to names of HTTP methods
public static final String []methodTransArray = {
"OPTIONS",
More information about the jboss-svn-commits
mailing list