diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java index 96463f0909..befb5c50cb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/AddressSettings.java @@ -175,11 +175,11 @@ public class AddressSettings implements Mergeable, Serializable private SimpleString expiryAddress = null; - private Long expiryDelay = AddressSettings.DEFAULT_EXPIRY_DELAY; + private Long expiryDelay = null; - private Long minExpiryDelay = AddressSettings.DEFAULT_MIN_EXPIRY_DELAY; + private Long minExpiryDelay = null; - private Long maxExpiryDelay = AddressSettings.DEFAULT_MAX_EXPIRY_DELAY; + private Long maxExpiryDelay = null; private Boolean defaultLastValueQueue = null; @@ -769,7 +769,7 @@ public class AddressSettings implements Mergeable, Serializable } public Long getExpiryDelay() { - return expiryDelay; + return expiryDelay != null ? expiryDelay : AddressSettings.DEFAULT_EXPIRY_DELAY; } public AddressSettings setExpiryDelay(final Long expiryDelay) { @@ -778,7 +778,7 @@ public class AddressSettings implements Mergeable, Serializable } public Long getMinExpiryDelay() { - return minExpiryDelay; + return minExpiryDelay != null ? minExpiryDelay : AddressSettings.DEFAULT_MIN_EXPIRY_DELAY; } public AddressSettings setMinExpiryDelay(final Long minExpiryDelay) { @@ -787,7 +787,7 @@ public class AddressSettings implements Mergeable, Serializable } public Long getMaxExpiryDelay() { - return maxExpiryDelay; + return maxExpiryDelay != null ? maxExpiryDelay : AddressSettings.DEFAULT_MAX_EXPIRY_DELAY; } public AddressSettings setMaxExpiryDelay(final Long maxExpiryDelay) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java index 722d24b3e1..0d6e5006b2 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/AddressSettingsTest.java @@ -71,6 +71,9 @@ public class AddressSettingsTest extends ActiveMQTestBase { addressSettingsToMerge.setPageSizeBytes(1004); addressSettingsToMerge.setMaxSizeBytesRejectThreshold(10 * 1024); addressSettingsToMerge.setConfigDeleteDiverts(DeletionPolicy.FORCE); + addressSettingsToMerge.setExpiryDelay(999L); + addressSettingsToMerge.setMinExpiryDelay(888L); + addressSettingsToMerge.setMaxExpiryDelay(777L); addressSettings.merge(addressSettingsToMerge); Assert.assertEquals(addressSettings.getDeadLetterAddress(), DLQ); @@ -84,6 +87,9 @@ public class AddressSettingsTest extends ActiveMQTestBase { Assert.assertEquals(AddressFullMessagePolicy.DROP, addressSettings.getAddressFullMessagePolicy()); Assert.assertEquals(addressSettings.getMaxSizeBytesRejectThreshold(), 10 * 1024); Assert.assertEquals(DeletionPolicy.FORCE, addressSettings.getConfigDeleteDiverts()); + Assert.assertEquals(Long.valueOf(999), addressSettings.getExpiryDelay()); + Assert.assertEquals(Long.valueOf(888), addressSettings.getMinExpiryDelay()); + Assert.assertEquals(Long.valueOf(777), addressSettings.getMaxExpiryDelay()); } @Test