tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1682977 - in /tomcat/trunk/java/org/apache/coyote/http2: AbstractStream.java Http2UpgradeHandler.java Stream.java
Date Mon, 01 Jun 2015 19:32:34 GMT
Author: markt
Date: Mon Jun  1 19:32:34 2015
New Revision: 1682977

URL: http://svn.apache.org/r1682977
Log:
Store connectionId as a string so it is only converted once (it is only ever used in String
form)

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java
    tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java?rev=1682977&r1=1682976&r2=1682977&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/AbstractStream.java Mon Jun  1 19:32:34 2015
@@ -107,7 +107,7 @@ abstract class AbstractStream {
 
     protected abstract Log getLog();
 
-    protected abstract int getConnectionId();
+    protected abstract String getConnectionId();
 
     protected abstract int getWeight();
 }

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1682977&r1=1682976&r2=1682977&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Mon Jun  1 19:32:34
2015
@@ -101,7 +101,7 @@ public class Http2UpgradeHandler extends
     private static final byte[] HTTP2_UPGRADE_ACK = ("HTTP/1.1 101 Switching Protocols\r\n"
+
                 "Connection: Upgrade\r\nUpgrade: h2c\r\n\r\n").getBytes(StandardCharsets.ISO_8859_1);
 
-    private final int connectionId;
+    private final String connectionId;
 
     private final Adapter adapter;
     private volatile SocketWrapperBase<?> socketWrapper;
@@ -136,7 +136,7 @@ public class Http2UpgradeHandler extends
     public Http2UpgradeHandler(Adapter adapter, Request coyoteRequest) {
         super (STREAM_ID_ZERO);
         this.adapter = adapter;
-        this.connectionId = connectionIdGenerator.getAndIncrement();
+        this.connectionId = Integer.toString(connectionIdGenerator.getAndIncrement());
 
         // Initial HTTP request becomes stream 0.
         if (coyoteRequest != null) {
@@ -151,7 +151,7 @@ public class Http2UpgradeHandler extends
     @Override
     public void init(WebConnection webConnection) {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.init", Long.toString(connectionId)));
+            log.debug(sm.getString("upgradeHandler.init", connectionId));
         }
 
         parser = new Http2Parser(this);
@@ -234,8 +234,7 @@ public class Http2UpgradeHandler extends
     @Override
     public SocketState upgradeDispatch(SocketStatus status) {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.upgradeDispatch.entry",
-                    Long.toString(connectionId), status));
+            log.debug(sm.getString("upgradeHandler.upgradeDispatch.entry", connectionId,
status));
         }
 
         if (!initialized) {
@@ -269,8 +268,7 @@ public class Http2UpgradeHandler extends
                 }
             } catch (IOException ioe) {
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("upgradeHandler.ioerror",
-                            Long.toString(connectionId)), ioe);
+                    log.debug(sm.getString("upgradeHandler.ioerror", connectionId), ioe);
                 }
                 close();
                 result = SocketState.CLOSED;
@@ -295,8 +293,7 @@ public class Http2UpgradeHandler extends
                 }
             } catch (IOException ioe) {
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("upgradeHandler.ioerror",
-                            Long.toString(connectionId)), ioe);
+                    log.debug(sm.getString("upgradeHandler.ioerror", connectionId), ioe);
                 }
                 close();
                 result = SocketState.CLOSED;
@@ -326,8 +323,7 @@ public class Http2UpgradeHandler extends
         }
 
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.upgradeDispatch.exit",
-                    Long.toString(connectionId), result));
+            log.debug(sm.getString("upgradeHandler.upgradeDispatch.exit", connectionId, result));
         }
         return result;
     }
@@ -376,9 +372,9 @@ public class Http2UpgradeHandler extends
 
     private void processFrameData(int flags, int streamId, int payloadSize) throws IOException
{
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
 
         // Validate the stream
@@ -417,9 +413,9 @@ public class Http2UpgradeHandler extends
 
     private void processFrameHeaders(int flags, int streamId, int payloadSize) throws IOException
{
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
 
         // Validate the stream
@@ -501,9 +497,9 @@ public class Http2UpgradeHandler extends
 
     private void processFramePriority(int flags, int streamId, int payloadSize) throws IOException
{
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
         // Validate the frame
         if (streamId == 0) {
@@ -543,9 +539,9 @@ public class Http2UpgradeHandler extends
 
     private void processFrameSettings(int flags, int streamId, int payloadSize) throws IOException
{
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
         // Validate the frame
         if (streamId != 0) {
@@ -591,9 +587,9 @@ public class Http2UpgradeHandler extends
     private void processFramePing(int flags, int streamId, int payloadSize)
             throws IOException {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
         // Validate the frame
         if (streamId != 0) {
@@ -623,9 +619,9 @@ public class Http2UpgradeHandler extends
     private void processFrameWindowUpdate(int flags, int streamId, int payloadSize)
             throws IOException {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrame",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(flags), Integer.toString(payloadSize)));
+            log.debug(sm.getString("upgradeHandler.processFrame", connectionId,
+                    Integer.toString(streamId), Integer.toString(flags),
+                    Integer.toString(payloadSize)));
         }
         // Validate the frame
         if (payloadSize != 4) {
@@ -639,9 +635,8 @@ public class Http2UpgradeHandler extends
         int windowSizeIncrement = ByteUtil.get31Bits(payload, 0);
 
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.processFrameWindowUpdate.debug",
-                    Long.toString(connectionId), Integer.toString(streamId),
-                    Integer.toString(windowSizeIncrement)));
+            log.debug(sm.getString("upgradeHandler.processFrameWindowUpdate.debug", connectionId,
+                    Integer.toString(streamId), Integer.toString(windowSizeIncrement)));
         }
 
         // Validate the data
@@ -799,8 +794,8 @@ public class Http2UpgradeHandler extends
 
     void writeHeaders(Stream stream, Response coyoteResponse) throws IOException {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.writeHeaders",
-                    Integer.toString(connectionId), stream.getIdentifier()));
+            log.debug(sm.getString("upgradeHandler.writeHeaders", connectionId,
+                    stream.getIdentifier()));
         }
         MimeHeaders headers = coyoteResponse.getMimeHeaders();
         // Add the pseudo header for status
@@ -842,8 +837,8 @@ public class Http2UpgradeHandler extends
 
     void writeBody(Stream stream, ByteBuffer data, int len) throws IOException {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("upgradeHandler.writeBody", Integer.toString(connectionId),
-                    stream.getIdentifier(), Integer.toString(data.remaining())));
+            log.debug(sm.getString("upgradeHandler.writeBody", connectionId, stream.getIdentifier(),
+                    Integer.toString(data.remaining())));
         }
         synchronized (socketWrapper) {
             byte[] header = new byte[9];
@@ -1030,7 +1025,7 @@ public class Http2UpgradeHandler extends
 
 
     @Override
-    protected final int getConnectionId() {
+    protected final String getConnectionId() {
         return connectionId;
     }
 

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1682977&r1=1682976&r2=1682977&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Mon Jun  1 19:32:34 2015
@@ -64,7 +64,7 @@ public class Stream extends AbstractStre
     public void rePrioritise(AbstractStream parent, boolean exclusive, int weight) {
         if (getLog().isDebugEnabled()) {
             getLog().debug(sm.getString("abstractStream.reprioritisation.debug",
-                    Long.toString(getConnectionId()), getIdentifier(), Boolean.toString(exclusive),
+                    getConnectionId(), getIdentifier(), Boolean.toString(exclusive),
                     parent.getIdentifier(), Integer.toString(weight)));
         }
 
@@ -118,8 +118,8 @@ public class Stream extends AbstractStre
     @Override
     public void emitHeader(String name, String value, boolean neverIndex) {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("stream.header.debug",
-                    Long.toString(getConnectionId()), getIdentifier(), name, value));
+            log.debug(sm.getString("stream.header.debug",getConnectionId(), getIdentifier(),
+                    name, value));
         }
 
         switch(name) {
@@ -169,8 +169,7 @@ public class Stream extends AbstractStre
 
     void flushData() {
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("stream.write",
-                    Long.toString(getConnectionId()), getIdentifier()));
+            log.debug(sm.getString("stream.write",getConnectionId(), getIdentifier()));
         }
         try {
             outputBuffer.flush();
@@ -188,7 +187,7 @@ public class Stream extends AbstractStre
 
 
     @Override
-    protected final int getConnectionId() {
+    protected final String getConnectionId() {
         return getParentStream().getConnectionId();
     }
 



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


Mime
View raw message