public class DefaultChannelGroup extends java.util.AbstractSet<Channel> implements ChannelGroup
ChannelGroup
implementation.构造器和说明 |
---|
DefaultChannelGroup()
Creates a new group with a generated name.
|
DefaultChannelGroup(java.lang.String name)
Creates a new group with the specified
name . |
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(Channel channel) |
void |
clear() |
ChannelGroupFuture |
close()
Closes all
Channel s in this group. |
int |
compareTo(ChannelGroup o) |
boolean |
contains(java.lang.Object o) |
ChannelGroupFuture |
disconnect()
Disconnects all
Channel s in this group from their remote peers. |
boolean |
equals(java.lang.Object o) |
Channel |
find(java.lang.Integer id)
Returns the
Channel whose ID matches the specified integer. |
java.lang.String |
getName()
Returns the name of this group.
|
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<Channel> |
iterator() |
boolean |
remove(java.lang.Object o) |
ChannelGroupFuture |
setInterestOps(int interestOps)
|
ChannelGroupFuture |
setReadable(boolean readable)
Calls
Channel.setReadable(boolean) for all Channel s in
this group with the specified boolean flag. |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
ChannelGroupFuture |
unbind()
Unbinds all
Channel s in this group from their local address. |
ChannelGroupFuture |
write(java.lang.Object message)
Writes the specified
message to all Channel s in this
group. |
ChannelGroupFuture |
write(java.lang.Object message,
java.net.SocketAddress remoteAddress)
|
public DefaultChannelGroup()
public DefaultChannelGroup(java.lang.String name)
name
. Please note that
different groups can have the same name, which means no duplicate check
is done against group names.public java.lang.String getName()
ChannelGroup
getName
在接口中 ChannelGroup
public boolean isEmpty()
public int size()
public Channel find(java.lang.Integer id)
ChannelGroup
Channel
whose ID matches the specified integer.find
在接口中 ChannelGroup
Channel
if found. null
otherwise.public boolean contains(java.lang.Object o)
public boolean add(Channel channel)
public boolean remove(java.lang.Object o)
public void clear()
public java.util.Iterator<Channel> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public ChannelGroupFuture close()
ChannelGroup
Channel
s 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
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture disconnect()
ChannelGroup
Channel
s in this group from their remote peers.disconnect
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture setInterestOps(int interestOps)
ChannelGroup
Channel.setInterestOps(int)
for all Channel
s in
this group with the specified interestOps
. Please note that
this operation is asynchronous as Channel.setInterestOps(int)
is.setInterestOps
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture setReadable(boolean readable)
ChannelGroup
Channel.setReadable(boolean)
for all Channel
s in
this group with the specified boolean flag. Please note that this
operation is asynchronous as Channel.setReadable(boolean)
is.setReadable
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture unbind()
ChannelGroup
Channel
s in this group from their local address.unbind
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture write(java.lang.Object message)
ChannelGroup
message
to all Channel
s in this
group. If the specified message
is an instance of
ChannelBuffer
, it is automatically
duplicated to avoid a race
condition. Please note that this operation is asynchronous as
Channel.write(Object)
is.write
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic ChannelGroupFuture write(java.lang.Object message, java.net.SocketAddress remoteAddress)
ChannelGroup
message
with the specified
remoteAddress
to all Channel
s in this group. If the
specified message
is an instance of ChannelBuffer
, it is
automatically duplicated to avoid
a race condition. Please note that this operation is asynchronous as
Channel.write(Object, SocketAddress)
is.write
在接口中 ChannelGroup
ChannelGroupFuture
instance that notifies when
the operation is done for all channelspublic int hashCode()
public boolean equals(java.lang.Object o)
public int compareTo(ChannelGroup o)
compareTo
在接口中 java.lang.Comparable<ChannelGroup>
public java.lang.String toString()
toString
在类中 java.util.AbstractCollection<Channel>