Class DestinationMap

java.lang.Object
org.apache.activemq.filter.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.
  • Field Details

  • Constructor Details

    • DestinationMap

      public DestinationMap()
  • Method Details

    • 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.
    • unsynchronizedGet

      public Set unsynchronizedGet(ActiveMQDestination key)
    • put

      public void put(ActiveMQDestination key, Object value)
    • unsynchronizedPut

      public void unsynchronizedPut(ActiveMQDestination key, Object value)
    • remove

      public void remove(ActiveMQDestination key, Object value)
      Removes the value from the associated destination
    • unsynchronizedRemove

      public void unsynchronizedRemove(ActiveMQDestination key, Object value)
    • getTopicRootChildCount

      public int getTopicRootChildCount()
    • getQueueRootChildCount

      public int getQueueRootChildCount()
    • getQueueRootNode

      public DestinationMapNode getQueueRootNode()
    • getTopicRootNode

      public DestinationMapNode getTopicRootNode()
    • getTempQueueRootNode

      public DestinationMapNode getTempQueueRootNode()
    • getTempTopicRootNode

      public DestinationMapNode getTempTopicRootNode()
    • 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.
    • findWildcardMatches

      protected Set findWildcardMatches(ActiveMQDestination key)
    • findWildcardMatches

      protected Set findWildcardMatches(ActiveMQDestination key, boolean deep)
    • removeAll

      public Set removeAll(ActiveMQDestination key)
      Parameters:
      key -
      Returns:
    • 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
    • getRootNode

      protected DestinationMapNode getRootNode(ActiveMQDestination key)
      Returns the root node for the given destination type
    • reset

      public void reset()
    • isEmpty

      public boolean isEmpty()
    • union

      public static Set union(Set existing, Set candidates)