public class DefaultChannelGroup extends AbstractSet<Channel> implements ChannelGroup
ChannelGroup implementation.| Constructor and Description |
|---|
DefaultChannelGroup(EventExecutor executor)
Creates a new group with a generated name and the provided
EventExecutor to notify the
ChannelGroupFutures. |
DefaultChannelGroup(String name,
EventExecutor executor)
|
removeAlladdAll, containsAll, retainAllclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, removeAll, retainAllpublic DefaultChannelGroup(EventExecutor executor)
EventExecutor to notify the
ChannelGroupFutures.public DefaultChannelGroup(String name, EventExecutor executor)
name and EventExecutor to notify the
ChannelGroupFutures. Please note that different groups can have the same name, which means no
duplicate check is done against group names.public String name()
ChannelGroupname in interface ChannelGrouppublic Channel find(ChannelId id)
ChannelGroupfind in interface ChannelGroupChannel if found. null otherwise.public boolean isEmpty()
isEmpty in interface Collection<Channel>isEmpty in interface Set<Channel>isEmpty in class AbstractCollection<Channel>public int size()
size in interface Collection<Channel>size in interface Set<Channel>size in class AbstractCollection<Channel>public boolean contains(Object o)
contains in interface Collection<Channel>contains in interface Set<Channel>contains in class AbstractCollection<Channel>public boolean add(Channel channel)
add in interface Collection<Channel>add in interface Set<Channel>add in class AbstractCollection<Channel>public boolean remove(Object o)
remove in interface Collection<Channel>remove in interface Set<Channel>remove in class AbstractCollection<Channel>public void clear()
clear in interface Collection<Channel>clear in interface Set<Channel>clear in class AbstractCollection<Channel>public Object[] toArray()
toArray in interface Collection<Channel>toArray in interface Set<Channel>toArray in class AbstractCollection<Channel>public <T> T[] toArray(T[] a)
toArray in interface Collection<Channel>toArray in interface Set<Channel>toArray in class AbstractCollection<Channel>public ChannelGroupFuture close()
ChannelGroupChannels in this group. If the Channel is
connected to a remote peer or bound to a local address, it is
automatically disconnected and unbound.close in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture disconnect()
ChannelGroupChannels in this group from their remote peers.disconnect in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture deregister()
ChannelGroupChannels in this group from their EventLoop.
Please note that this operation is asynchronous as Channel.deregister() is.deregister in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture write(Object message)
ChannelGroupmessage to all Channels in this
group. If the specified message is an instance of
ByteBuf, it is automatically
duplicated to avoid a race
condition. The same is true for ByteBufHolder. Please note that this operation is asynchronous as
Channel.write(Object) is.write in interface ChannelGrouppublic ChannelGroupFuture write(Object message, ChannelMatcher matcher)
ChannelGroupmessage to all Channels in this
group that match the given ChannelMatcher. If the specified message is an instance of
ByteBuf, it is automatically
duplicated to avoid a race
condition. The same is true for ByteBufHolder. Please note that this operation is asynchronous as
Channel.write(Object) is.write in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroup flush()
ChannelGroupChannels in this
group. If the specified messages are an instance of
ByteBuf, it is automatically
duplicated to avoid a race
condition. Please note that this operation is asynchronous as
Channel.write(Object) is.flush in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture writeAndFlush(Object message)
ChannelGroupChannelGroup.write(Object) and ChannelGroup.flush().writeAndFlush in interface ChannelGrouppublic ChannelGroupFuture disconnect(ChannelMatcher matcher)
ChannelGroupChannels in this group from their remote peers,
that match the given ChannelMatcher.disconnect in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture close(ChannelMatcher matcher)
ChannelGroupChannels in this group that match the given ChannelMatcher.
If the Channel is connected to a remote peer or bound to a local address, it is
automatically disconnected and unbound.close in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture deregister(ChannelMatcher matcher)
ChannelGroupChannels in this group from their EventLoop that match the given
ChannelMatcher. Please note that this operation is asynchronous as Channel.deregister() is.deregister in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroup flush(ChannelMatcher matcher)
ChannelGroupChannels in this group that match the given ChannelMatcher.
If the specified messages are an instance of
ByteBuf, it is automatically
duplicated to avoid a race
condition. Please note that this operation is asynchronous as
Channel.write(Object) is.flush in interface ChannelGroupChannelGroupFuture instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture writeAndFlush(Object message, ChannelMatcher matcher)
ChannelGroupChannelGroup.write(Object) and ChannelGroup.flush() and only act on
Channels that match the ChannelMatcher.writeAndFlush in interface ChannelGrouppublic int hashCode()
hashCode in interface Collection<Channel>hashCode in interface Set<Channel>hashCode in class AbstractSet<Channel>public boolean equals(Object o)
equals in interface Collection<Channel>equals in interface Set<Channel>equals in class AbstractSet<Channel>public int compareTo(ChannelGroup o)
compareTo in interface Comparable<ChannelGroup>public String toString()
toString in class AbstractCollection<Channel>Copyright © 2008–2015 The Netty Project. All rights reserved.