activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-2099 Avoid possible double instantiation of properties
Date Wed, 26 Sep 2018 21:07:08 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 10ecb358c -> 5a600114b


ARTEMIS-2099 Avoid possible double instantiation of properties


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

Branch: refs/heads/master
Commit: 8ab3be71a3ebc5667c402c2b6e6458cb73bce616
Parents: 10ecb35
Author: Michael André Pearce <michael.andre.pearce@me.com>
Authored: Wed Sep 26 21:11:24 2018 +0100
Committer: Justin Bertram <jbertram@apache.org>
Committed: Wed Sep 26 15:40:36 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/8ab3be71/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;


Mime
View raw message