[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 clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2115#discussion_r191917895
  
    --- 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 like having it explicitly as it shows my real intention.  Other than my ocd level not really needed.  


---