You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/09/15 13:27:04 UTC
[1/3] activemq-artemis git commit: STOMP frame encode: Avoid
StringBuilder resizing
Repository: activemq-artemis
Updated Branches:
refs/heads/master afee9247e -> 6b06c08c9
STOMP frame encode: Avoid StringBuilder resizing
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/8e59cf4d
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/8e59cf4d
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/8e59cf4d
Branch: refs/heads/master
Commit: 8e59cf4d5fdfefc027ce26f7adb1a775738012f3
Parents: afee924
Author: Ville Skytt� <vi...@iki.fi>
Authored: Wed Sep 14 20:52:07 2016 +0300
Committer: Ville Skytt� <vi...@iki.fi>
Committed: Wed Sep 14 20:54:23 2016 +0300
----------------------------------------------------------------------
.../apache/activemq/artemis/core/protocol/stomp/StompFrame.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8e59cf4d/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
index 27b222b..044b2db 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
@@ -103,7 +103,7 @@ public class StompFrame {
return buffer;
}
- StringBuilder head = new StringBuilder();
+ StringBuilder head = new StringBuilder(512);
head.append(command);
head.append(Stomp.NEWLINE);
// Output the headers.
[3/3] activemq-artemis git commit: This closes #776
Posted by cl...@apache.org.
This closes #776
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/6b06c08c
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/6b06c08c
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/6b06c08c
Branch: refs/heads/master
Commit: 6b06c08c90c6810f19bf0fe19778d41311ad8f35
Parents: afee924 2c7c81c
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Sep 15 09:25:57 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Sep 15 09:25:57 2016 -0400
----------------------------------------------------------------------
.../artemis/core/protocol/stomp/StompFrame.java | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
[2/3] activemq-artemis git commit: STOMP frame encode: Use fixed
buffers
Posted by cl...@apache.org.
STOMP frame encode: Use fixed buffers
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2c7c81ca
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2c7c81ca
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2c7c81ca
Branch: refs/heads/master
Commit: 2c7c81ca9ea305ff3e34e4f0158ffbb46550dec2
Parents: 8e59cf4
Author: Ville Skytt� <vi...@iki.fi>
Authored: Wed Sep 14 20:53:27 2016 +0300
Committer: Ville Skytt� <vi...@iki.fi>
Committed: Wed Sep 14 20:54:28 2016 +0300
----------------------------------------------------------------------
.../artemis/core/protocol/stomp/StompFrame.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2c7c81ca/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
index 044b2db..5dd74f5 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
@@ -91,15 +91,10 @@ public class StompFrame {
public ActiveMQBuffer toActiveMQBuffer() throws Exception {
if (buffer == null) {
- if (bytesBody != null) {
- buffer = ActiveMQBuffers.dynamicBuffer(bytesBody.length + 512);
- }
- else {
- buffer = ActiveMQBuffers.dynamicBuffer(512);
- }
-
if (isPing()) {
- buffer.writeByte((byte) 10);
+ buffer = ActiveMQBuffers.fixedBuffer(1);
+ buffer.writeByte((byte)10);
+ size = buffer.writerIndex();
return buffer;
}
@@ -117,7 +112,12 @@ public class StompFrame {
// Add a newline to separate the headers from the content.
head.append(Stomp.NEWLINE);
- buffer.writeBytes(head.toString().getBytes(StandardCharsets.UTF_8));
+ byte[] headBytes = head.toString().getBytes(StandardCharsets.UTF_8);
+ int bodyLength = (bytesBody == null) ? 0 : bytesBody.length;
+
+ buffer = ActiveMQBuffers.fixedBuffer(headBytes.length + bodyLength + END_OF_FRAME.length);
+
+ buffer.writeBytes(headBytes);
if (bytesBody != null) {
buffer.writeBytes(bytesBody);
}