Class DestinationMap

  • Direct Known Subclasses:
    RedeliveryPolicyMap

    public class DestinationMap
    extends Object
    A Map-like data structure allowing values to be indexed by ActiveMQDestination and retrieved by destination - supporting both * and > style of wildcard as well as composite destinations.
    This class assumes that the index changes rarely but that fast lookup into the index is required. So this class maintains a pre-calculated index for destination steps. So looking up the values for "TEST.*" or "*.TEST" will be pretty fast.
    Looking up of a value could return a single value or a List of matching values if a wildcard or composite destination is used.
    • Constructor Detail

      • DestinationMap

        public DestinationMap()
    • Method Detail

      • get

        public Set get​(ActiveMQDestination key)
        Looks up the value(s) matching the given Destination key. For simple destinations this is typically a List of one single value, for wildcards or composite destinations this will typically be a List of matching values.
        Parameters:
        key - the destination to lookup
        Returns:
        a List of matching values or an empty list if there are no matching values.
      • getTopicRootChildCount

        public int getTopicRootChildCount()
      • getQueueRootChildCount

        public int getQueueRootChildCount()
      • setEntries

        protected void setEntries​(List<DestinationMapEntry> entries)
        A helper method to allow the destination map to be populated from a dependency injection framework such as Spring
      • getEntryClass

        protected Class<? extends DestinationMapEntry> getEntryClass()
        Returns the type of the allowed entries which can be set via the setEntries(List) method. This allows derived classes to further restrict the type of allowed entries to make a type safe destination map for custom policies.
      • chooseValue

        public DestinationMapEntry chooseValue​(ActiveMQDestination destination)
        Returns the value which matches the given destination or null if there is no matching value. If there are multiple values, the results are sorted and the last item (the biggest) is returned.
        Parameters:
        destination - the destination to find the value for
        Returns:
        the largest matching value or null if no value matches
      • reset

        public void reset()
      • isEmpty

        public boolean isEmpty()
      • union

        public static Set union​(Set existing,
                                Set candidates)