Class ChannelID

    • Constructor Detail

      • ChannelID

        public ChannelID​(String appPref,
                         String replicaId,
                         boolean useNodeId,
                         boolean useAppInstId,
                         boolean isTopic)
        Constructor of channel names. The constructor is package private because we should never use any channels except the ones constructed by our friend Channels.java
        Parameters:
        appPref - The prefix used for the applications listening to the channel.
        replicaId - Name of the replica, or ChannelID.COMMON if channel shared by all replicas.
        useNodeId - Whether that IP address of the local node should be included in the channel name.
        useAppInstId - Whether application instance id from settings should be included in the channel name.
        isTopic - Whether the Channel is a Topic or a Queue.
        Throws:
        UnknownID - if looking up the local IP number failed.
    • Method Detail

      • getName

        public String getName()
        Getter for the channel name.
        Returns:
        The name of the channel referred to by this object.
      • toString

        public String toString()
        Pretty-printer.
        Overrides:
        toString in class Object
        Returns:
        a nice String representation of the ChannelID.
      • equals

        public boolean equals​(Object o)
        Implements equality check for ChannelIDs. Useful when these are used as indexes in Java collections, for instance.
        Overrides:
        equals in class Object
        Parameters:
        o - The object to compare this object with.
        Returns:
        Whether o and this should be considered the same ChannelID.
      • hashCode

        public int hashCode()
        Computes a hash code based on the channel name and whether it is a topic.
        Overrides:
        hashCode in class Object
        Returns:
        A hash code for this object.