Class ContainerGroup

  • All Implemented Interfaces:
    org.springframework.context.Lifecycle

    public class ContainerGroup
    extends java.lang.Object
    implements org.springframework.context.Lifecycle
    A group of listener containers.
    Since:
    2.7.3
    Author:
    Gary Russell
    • Constructor Detail

      • ContainerGroup

        public ContainerGroup​(java.lang.String name)
        Construct an instance with the provided name.
        Parameters:
        name - the group name.
      • ContainerGroup

        public ContainerGroup​(java.lang.String name,
                              java.util.List<MessageListenerContainer> containers)
        Construct an instance with the provided name and containers.
        Parameters:
        name - the group name.
        containers - the containers.
      • ContainerGroup

        public ContainerGroup​(java.lang.String name,
                              MessageListenerContainer... containers)
        Construct an instance with the provided name and containers.
        Parameters:
        name - the group name.
        containers - the containers.
    • Method Detail

      • getName

        public java.lang.String getName()
        Return the group name.
        Returns:
        the name.
      • getListenerIds

        public java.util.Collection<java.lang.String> getListenerIds()
        Return the listener ids of the containers in this group.
        Returns:
        the listener ids.
      • contains

        public boolean contains​(MessageListenerContainer container)
        Return true if the provided container is in this group.
        Parameters:
        container - the container.
        Returns:
        true if it is in this group.
      • allStopped

        public boolean allStopped()
        Return true if all containers in this group are stopped.
        Returns:
        true if all are stopped.
      • addContainers

        public void addContainers​(MessageListenerContainer... theContainers)
        Add one or more containers to the group.
        Parameters:
        theContainers - the container(s).
      • removeContainer

        public boolean removeContainer​(MessageListenerContainer container)
        Remove a container from the group.
        Parameters:
        container - the container.
        Returns:
        true if the container was removed.
      • start

        public void start()
        Specified by:
        start in interface org.springframework.context.Lifecycle
      • stop

        public void stop()
        Specified by:
        stop in interface org.springframework.context.Lifecycle
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface org.springframework.context.Lifecycle
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object