ARTEMIS-2099 Avoid possible double instantiation of properties

This commit is contained in:
Michael André Pearce 2018-09-26 21:11:24 +01:00 committed by Justin Bertram
parent 10ecb358cb
commit 8ab3be71a3
1 changed files with 9 additions and 5 deletions

View File

@ -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;