You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2018/09/26 21:08:17 UTC

activemq-artemis git commit: ARTEMIS-2099 Avoid possible double instantiation of properties

Repository: activemq-artemis
Updated Branches:
  refs/heads/2.6.x 2aa7844d5 -> fd303af82


ARTEMIS-2099 Avoid possible double instantiation of properties

(cherry picked from commit 8ab3be71a3ebc5667c402c2b6e6458cb73bce616)


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/fd303af8
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/fd303af8
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/fd303af8

Branch: refs/heads/2.6.x
Commit: fd303af827f9adbcec27a0f8a191525750e76335
Parents: 2aa7844
Author: Michael André Pearce <mi...@me.com>
Authored: Wed Sep 26 21:11:24 2018 +0100
Committer: Justin Bertram <jb...@apache.org>
Committed: Wed Sep 26 16:07:52 2018 -0500

----------------------------------------------------------------------
 .../artemis/core/message/impl/CoreMessage.java        | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd303af8/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index cc79c2c..b548b29 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -551,12 +551,16 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
     */
    protected TypedProperties checkProperties() {
       if (properties == null) {
-         TypedProperties properties = new TypedProperties();
-         if (buffer != null && propertiesLocation >= 0) {
-            final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation);
-            properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
+         synchronized (this) {
+            if (properties == null) {
+               TypedProperties properties = new TypedProperties();
+               if (buffer != null && propertiesLocation >= 0) {
+                  final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation);
+                  properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
+               }
+               this.properties = properties;
+            }
          }
-         this.properties = properties;
       }
 
       return this.properties;