Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1752#discussion_r160005561
--- Diff:
artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ServerPacketDecoder.java
---
@@ -83,16 +85,34 @@
public class ServerPacketDecoder extends ClientPacketDecoder {
+ private static final int UUID_LENGTH = 36;
+ private static final int DEFAULT_INTERNER_CAPACITY = 32;
private static final long serialVersionUID = 3348673114388400766L;
- public static final ServerPacketDecoder INSTANCE = new
ServerPacketDecoder();
+ private SimpleString.Interner keysInterner;
+ private TypedProperties.StringValue.Interner valuesInterner;
- private static SessionSendMessage decodeSessionSendMessage(final
ActiveMQBuffer in, CoreRemotingConnection connection) {
+ public ServerPacketDecoder() {
+ this.keysInterner = null;
+ this.valuesInterner = null;
+ }
+
+ private void initializeInternersIfNeeded() {
--- End diff --
sadly we can't do it with ease for different reasons:
- most byte[] operations are optimized by the JVM to avoid most of the
bounds checks, on ByteBuf I've just provided a PR on Netty to improve this thing
- I wouldn't change SimpleString that is used everywhere (literally) on
Artemis
- the lifecycle of the original ByteBuf is not predicatable: sometimes are
pooled sometimes not, offheap/onheap...not that simple honestly
---