Class DefaultChannelGroup

    • Field Detail

      • nextId

        private static final java.util.concurrent.atomic.AtomicInteger nextId
      • name

        private final java.lang.String name
      • serverChannels

        private final java.util.concurrent.ConcurrentMap<java.lang.Integer,​Channel> serverChannels
      • nonServerChannels

        private final java.util.concurrent.ConcurrentMap<java.lang.Integer,​Channel> nonServerChannels
    • Constructor Detail

      • DefaultChannelGroup

        public DefaultChannelGroup()
        Creates a new group with a generated name.
      • DefaultChannelGroup

        public DefaultChannelGroup​(java.lang.String name)
        Creates a new group with the specified name. Please note that different groups can have the same name, which means no duplicate check is done against group names.
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: ChannelGroup
        Returns the name of this group. A group name is purely for helping you to distinguish one group from others.
        Specified by:
        getName in interface ChannelGroup
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<Channel>
        Specified by:
        isEmpty in interface java.util.Set<Channel>
        Overrides:
        isEmpty in class java.util.AbstractCollection<Channel>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<Channel>
        Specified by:
        size in interface java.util.Set<Channel>
        Specified by:
        size in class java.util.AbstractCollection<Channel>
      • find

        public Channel find​(java.lang.Integer id)
        Description copied from interface: ChannelGroup
        Returns the Channel whose ID matches the specified integer.
        Specified by:
        find in interface ChannelGroup
        Returns:
        the matching Channel if found. null otherwise.
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<Channel>
        Specified by:
        contains in interface java.util.Set<Channel>
        Overrides:
        contains in class java.util.AbstractCollection<Channel>
      • add

        public boolean add​(Channel channel)
        Specified by:
        add in interface java.util.Collection<Channel>
        Specified by:
        add in interface java.util.Set<Channel>
        Overrides:
        add in class java.util.AbstractCollection<Channel>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<Channel>
        Specified by:
        remove in interface java.util.Set<Channel>
        Overrides:
        remove in class java.util.AbstractCollection<Channel>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<Channel>
        Specified by:
        clear in interface java.util.Set<Channel>
        Overrides:
        clear in class java.util.AbstractCollection<Channel>
      • iterator

        public java.util.Iterator<Channel> iterator()
        Specified by:
        iterator in interface java.util.Collection<Channel>
        Specified by:
        iterator in interface java.lang.Iterable<Channel>
        Specified by:
        iterator in interface java.util.Set<Channel>
        Specified by:
        iterator in class java.util.AbstractCollection<Channel>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<Channel>
        Specified by:
        toArray in interface java.util.Set<Channel>
        Overrides:
        toArray in class java.util.AbstractCollection<Channel>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<Channel>
        Specified by:
        toArray in interface java.util.Set<Channel>
        Overrides:
        toArray in class java.util.AbstractCollection<Channel>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<Channel>
        Specified by:
        hashCode in interface java.util.Set<Channel>
        Overrides:
        hashCode in class java.util.AbstractSet<Channel>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<Channel>
        Specified by:
        equals in interface java.util.Set<Channel>
        Overrides:
        equals in class java.util.AbstractSet<Channel>
      • compareTo

        public int compareTo​(ChannelGroup o)
        Specified by:
        compareTo in interface java.lang.Comparable<ChannelGroup>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractCollection<Channel>