Class MessageEvictionStrategySupport
java.lang.Object
org.apache.activemq.broker.region.policy.MessageEvictionStrategySupport
- All Implemented Interfaces:
MessageEvictionStrategy
- Direct Known Subclasses:
OldestMessageEvictionStrategy, OldestMessageWithLowestPriorityEvictionStrategy, UniquePropertyMessageEvictionStrategy
public abstract class MessageEvictionStrategySupport
extends Object
implements MessageEvictionStrategy
A useful base class for implementation inheritence.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintREturns the high water mark on which we will eagerly evict expired messages from RAMbooleanReturns whether the eager expired-message scan is enabled.voidsetEvictExpiredMessagesHighWatermark(int evictExpiredMessagesHighWaterMark) Sets the high water mark on which we will eagerly evict expired messages from RAMvoidsetExpiryCheckEnabled(boolean expiryCheckEnabled) Controls whether the broker performs an eager expired-message scan when a non-durable topic subscription's pending slow-consumer buffer exceedsgetEvictExpiredMessagesHighWatermark().Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MessageEvictionStrategy
evictMessages
-
Constructor Details
-
MessageEvictionStrategySupport
public MessageEvictionStrategySupport()
-
-
Method Details
-
getEvictExpiredMessagesHighWatermark
public int getEvictExpiredMessagesHighWatermark()Description copied from interface:MessageEvictionStrategyREturns the high water mark on which we will eagerly evict expired messages from RAM- Specified by:
getEvictExpiredMessagesHighWatermarkin interfaceMessageEvictionStrategy
-
setEvictExpiredMessagesHighWatermark
public void setEvictExpiredMessagesHighWatermark(int evictExpiredMessagesHighWaterMark) Sets the high water mark on which we will eagerly evict expired messages from RAM -
isExpiryCheckEnabled
public boolean isExpiryCheckEnabled()Description copied from interface:MessageEvictionStrategyReturns whether the eager expired-message scan is enabled.When
false, the O(n) scan insideTopicSubscription.add(MessageReference)is skipped entirely. Set tofalsewhen messages carry no TTL, or when the scan cost outweighs the benefit of eagerly evicting expired messages from slow-consumer buffers.See
MessageEvictionStrategySupportfor the default implementation that returnstrue.- Specified by:
isExpiryCheckEnabledin interfaceMessageEvictionStrategy- Returns:
trueif the expiry scan is enabled (default),falseif skipped
-
setExpiryCheckEnabled
public void setExpiryCheckEnabled(boolean expiryCheckEnabled) Controls whether the broker performs an eager expired-message scan when a non-durable topic subscription's pending slow-consumer buffer exceedsgetEvictExpiredMessagesHighWatermark().Set to
falsewhen messages carry no TTL, or when the O(n) scan cost outweighs the benefit of eagerly evicting expired messages from slow-consumer buffers. When messages have no TTL, every scan iterates the full buffer without removing anything, adding latency to every enqueue once the buffer exceeds the high-water mark.- Parameters:
expiryCheckEnabled-falseto skip the scan;trueto enable it (default)
-