[
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 michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2115#discussion_r191915585
--- 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 --
is this needed as anyhow last statement returns the address.
---