tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1137329 - in /tomcat/trunk/java/org/apache/coyote/ajp: AbstractAjpProcessor.java AjpAprProcessor.java AjpNioProcessor.java AjpProcessor.java
Date Sun, 19 Jun 2011 10:07:22 GMT
Author: markt
Date: Sun Jun 19 10:07:22 2011
New Revision: 1137329

URL: http://svn.apache.org/viewvc?rev=1137329&view=rev
Log:
Pull up definition of standard messages

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1137329&r1=1137328&r2=1137329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Sun Jun 19 10:07:22
2011
@@ -53,12 +53,65 @@ public abstract class AbstractAjpProcess
 
     protected abstract Log getLog();
 
+
     /**
      * The string manager for this package.
      */
     protected static final StringManager sm =
         StringManager.getManager(Constants.Package);
 
+
+    /**
+     * End message array.
+     */
+    protected static final byte[] endMessageArray;
+
+
+    /**
+     * Flush message array.
+     */
+    protected static final byte[] flushMessageArray;
+    
+
+    /**
+     * Pong message array.
+     */
+    protected static final byte[] pongMessageArray;
+
+
+    static {
+        // Allocate the end message array
+        AjpMessage endMessage = new AjpMessage(16);
+        endMessage.reset();
+        endMessage.appendByte(Constants.JK_AJP13_END_RESPONSE);
+        endMessage.appendByte(1);
+        endMessage.end();
+        endMessageArray = new byte[endMessage.getLen()];
+        System.arraycopy(endMessage.getBuffer(), 0, endMessageArray, 0,
+                endMessage.getLen());
+        
+        // Allocate the flush message array
+        AjpMessage flushMessage = new AjpMessage(16);
+        flushMessage.reset();
+        flushMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
+        flushMessage.appendInt(0);
+        flushMessage.appendByte(0);
+        flushMessage.end();
+        flushMessageArray = new byte[flushMessage.getLen()];
+        System.arraycopy(flushMessage.getBuffer(), 0, flushMessageArray, 0,
+                flushMessage.getLen());
+        
+        // Allocate the pong message array
+        AjpMessage pongMessage = new AjpMessage(16);
+        pongMessage.reset();
+        pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
+        pongMessage.end();
+        pongMessageArray = new byte[pongMessage.getLen()];
+        System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 
+                0, pongMessage.getLen());
+    }
+
+    
     // ----------------------------------------------------- Instance Variables
 
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1137329&r1=1137328&r2=1137329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Jun 19 10:07:22 2011
@@ -137,63 +137,6 @@ public class AjpAprProcessor extends Abs
     protected final ByteBuffer getBodyMessageBuffer;
 
 
-    /**
-     * Direct buffer used for sending right away a pong message.
-     */
-    protected static final ByteBuffer pongMessageBuffer;
-
-
-    /**
-     * End message array.
-     */
-    protected static final byte[] endMessageArray;
-
-
-    /**
-     * Direct buffer used for sending explicit flush message.
-     */
-    protected static final ByteBuffer flushMessageBuffer;
-
-
-    // ----------------------------------------------------- Static Initializer
-
-
-    static {
-
-        // Set the read body message buffer
-        AjpMessage pongMessage = new AjpMessage(16);
-        pongMessage.reset();
-        pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
-        pongMessage.end();
-        pongMessageBuffer = ByteBuffer.allocateDirect(pongMessage.getLen());
-        pongMessageBuffer.put(pongMessage.getBuffer(), 0,
-                pongMessage.getLen());
-
-        // Allocate the end message array
-        AjpMessage endMessage = new AjpMessage(16);
-        endMessage.reset();
-        endMessage.appendByte(Constants.JK_AJP13_END_RESPONSE);
-        endMessage.appendByte(1);
-        endMessage.end();
-        endMessageArray = new byte[endMessage.getLen()];
-        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());
-
-    }
-
-
     // --------------------------------------------------------- Public Methods
 
 
@@ -235,8 +178,8 @@ public class AjpAprProcessor extends Abs
                 // not regular request processing
                 int type = requestHeaderMessage.getByte();
                 if (type == Constants.JK_AJP13_CPING_REQUEST) {
-                    if (Socket.sendb(socketRef, pongMessageBuffer, 0,
-                            pongMessageBuffer.position()) < 0) {
+                    if (Socket.send(socketRef, pongMessageArray, 0,
+                            pongMessageArray.length) < 0) {
                         error = true;
                     }
                     continue;
@@ -612,8 +555,8 @@ public class AjpAprProcessor extends Abs
         }
         // Send explicit flush message
         if (explicit && !finished) {
-            if (Socket.sendb(socketRef, flushMessageBuffer, 0,
-                    flushMessageBuffer.position()) < 0) {
+            if (Socket.send(socketRef, flushMessageArray, 0,
+                    flushMessageArray.length) < 0) {
                 throw new IOException(sm.getString("ajpprocessor.failedflush"));
             }
         }

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1137329&r1=1137328&r2=1137329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Sun Jun 19 10:07:22 2011
@@ -120,64 +120,6 @@ public class AjpNioProcessor extends Abs
     protected final byte[] getBodyMessageArray;
 
 
-    /**
-     * Direct buffer used for sending right away a pong message.
-     */
-    protected static final byte[] pongMessageArray;
-
-
-    /**
-     * End message array.
-     */
-    protected static final byte[] endMessageArray;
-
-
-    /**
-     * Flush message array.
-     */
-    protected static final byte[] flushMessageArray;
-    
-    // ----------------------------------------------------- Static Initializer
-
-
-    static {
-
-        // Set the read body message buffer
-        AjpMessage pongMessage = new AjpMessage(16);
-        pongMessage.reset();
-        pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
-        pongMessage.end();
-        pongMessageArray = new byte[pongMessage.getLen()];
-        System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 
-                0, pongMessage.getLen());
-
-        // Allocate the end message array
-        AjpMessage endMessage = new AjpMessage(16);
-        endMessage.reset();
-        endMessage.appendByte(Constants.JK_AJP13_END_RESPONSE);
-        endMessage.appendByte(1);
-        endMessage.end();
-        endMessageArray = new byte[endMessage.getLen()];
-        System.arraycopy(endMessage.getBuffer(), 0, endMessageArray, 0,
-                endMessage.getLen());
-
-        // Allocate the flush message array
-        AjpMessage flushMessage = new AjpMessage(16);
-        flushMessage.reset();
-        flushMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
-        flushMessage.appendInt(0);
-        flushMessage.appendByte(0);
-        flushMessage.end();
-        flushMessageArray = new byte[flushMessage.getLen()];
-        System.arraycopy(flushMessage.getBuffer(), 0, flushMessageArray, 0,
-                flushMessage.getLen());
-
-    }
-
-
-    // ------------------------------------------------------------- Properties
-
-
     // --------------------------------------------------------- Public Methods
 
 

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1137329&r1=1137328&r2=1137329&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Sun Jun 19 10:07:22 2011
@@ -130,61 +130,6 @@ public class AjpProcessor extends Abstra
     protected final byte[] getBodyMessageArray;
 
 
-    /**
-     * Direct buffer used for sending right away a pong message.
-     */
-    protected static final byte[] pongMessageArray;
-
-
-    /**
-     * End message array.
-     */
-    protected static final byte[] endMessageArray;
-
-
-    /**
-     * Flush message array.
-     */
-    protected static final byte[] flushMessageArray;
-    
-    // ----------------------------------------------------- Static Initializer
-
-
-    static {
-
-        // Set the read body message buffer
-        AjpMessage pongMessage = new AjpMessage(16);
-        pongMessage.reset();
-        pongMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
-        pongMessage.end();
-        pongMessageArray = new byte[pongMessage.getLen()];
-        System.arraycopy(pongMessage.getBuffer(), 0, pongMessageArray, 
-                0, pongMessage.getLen());
-
-        // Allocate the end message array
-        AjpMessage endMessage = new AjpMessage(16);
-        endMessage.reset();
-        endMessage.appendByte(Constants.JK_AJP13_END_RESPONSE);
-        endMessage.appendByte(1);
-        endMessage.end();
-        endMessageArray = new byte[endMessage.getLen()];
-        System.arraycopy(endMessage.getBuffer(), 0, endMessageArray, 0,
-                endMessage.getLen());
-
-        // Allocate the flush message array
-        AjpMessage flushMessage = new AjpMessage(16);
-        flushMessage.reset();
-        flushMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
-        flushMessage.appendInt(0);
-        flushMessage.appendByte(0);
-        flushMessage.end();
-        flushMessageArray = new byte[flushMessage.getLen()];
-        System.arraycopy(flushMessage.getBuffer(), 0, flushMessageArray, 0,
-                flushMessage.getLen());
-
-    }
-
-
     // ------------------------------------------------------------- Properties
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message