Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2335#discussion_r220723361
--- Diff:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
---
@@ -551,12 +551,16 @@ public CoreMessage setUserID(UUID userID) {
*/
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) {
--- End diff --
This is double checked, thus once instantiated further calls don't incur
the synchronized cost. it imperative the field is volatile for this, but i
checked and properties is already volatile.
if (properties == null) {
synchronized (this) {
if (properties == null)
---