git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis pull request #2115: ARTEMIS-1858 Expiry messages are not tr...


Github user gemmellr commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2115#discussion_r191924187
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java ---
    @@ -604,26 +607,39 @@ public String getAddress() {
           return addressSimpleString == null ? null : addressSimpleString.toString();
        }
     
    +
    +   public SimpleString cachedAddressSimpleString(String address) {
    +      return CoreMessageObjectPools.cachedAddressSimpleString(address, coreMessageObjectPools);
    +   }
    +
        @Override
        public AMQPMessage setAddress(String address) {
    -      this.address = SimpleString.toSimpleString(address, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressStringSimpleStringPool());
    +      setAddress(cachedAddressSimpleString(address));
           return this;
        }
     
        @Override
        public AMQPMessage setAddress(SimpleString address) {
           this.address = address;
    +      createExtraProperties().putSimpleStringProperty(ADDRESS_PROPERTY, address);
           return this;
        }
     
        @Override
        public SimpleString getAddressSimpleString() {
           if (address == null) {
    -         Properties properties = getProtonMessage().getProperties();
    -         if (properties != null) {
    -            setAddress(properties.getTo());
    -         } else {
    -            return null;
    +
    +         address = createExtraProperties().getSimpleStringProperty(ADDRESS_PROPERTY);
    +
    +         if (address != null) {
    +            return address;
    +         }
    +
    +
    +         Properties properties = getProperties();
    +         if (properties != null && properties.getTo() != null) {
    +            address = cachedAddressSimpleString(properties.getTo());
    +            return address;
    --- End diff --
    
    I'd typically let it fall through here too, though in this case it really doesn't look that out of place considering the prior null check and exit above it already from checking the extra properties.


---