Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.netty.channel.group
Class DefaultChannelGroup

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractSet<Channel>
              org.jboss.netty.channel.group.DefaultChannelGroup

All Implemented Interfaces:
  Comparable<ChannelGroup>, Iterable<Channel>, Collection<Channel>, Set<Channel>, ChannelGroup

    public class DefaultChannelGroup

extends AbstractSet<Channel>
implements ChannelGroup

The default `ChannelGroup` implementation.

Version:
  $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
Author:
  The Netty Project, Trustin Lee

Constructor Summary
`DefaultChannelGroup()` Creates a new group with a generated name.
`DefaultChannelGroup(String name)` Creates a new group with the specified `name`.

Method Summary
`boolean` | `add(Channel channel)`
`void` | `clear()`
`ChannelGroupFuture` | `close()` Closes all `Channel`s in this group.
`int` | `compareTo(ChannelGroup o)`
`boolean` | `contains(Object o)`
`ChannelGroupFuture` | `disconnect()` Disconnects all `Channel`s in this group from their remote peers.
`boolean` | `equals(Object o)`
`Channel` | `find(Integer id)` Returns the `Channel` whose ID matches the specified integer.
`String` | `getName()` Returns the name of this group.
`int` | `hashCode()`
`boolean` | `isEmpty()`
`Iterator<Channel>` | `iterator()`
`boolean` | `remove(Object o)`
`ChannelGroupFuture` | `setInterestOps(int interestOps)` Calls `Channel.setInterestOps(int)` for all `Channel`s in this group with the specified `interestOps`.
`ChannelGroupFuture` | `setReadable(boolean readable)` Calls `Channel.setReadable(boolean)` for all `Channel`s in this group with the specified boolean flag.
`int` | `size()`
`Object[]` | `toArray()`
`
`<T> T[]`
` | `toArray(T[] a)`
`String` | `toString()`
`ChannelGroupFuture` | `unbind()` Unbinds all `Channel`s in this group from their local address.
`ChannelGroupFuture` | `write(Object message)` Writes the specified `message` to all `Channel`s in this group.
`ChannelGroupFuture` | `write(Object message, SocketAddress remoteAddress)` Writes the specified `message` with the specified `remoteAddress` to all `Channel`s in this group.

Methods inherited from class java.util.AbstractSet
`removeAll`

Methods inherited from class java.util.AbstractCollection
`addAll, containsAll, retainAll`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`addAll, containsAll, removeAll, retainAll`

Constructor Detail

### DefaultChannelGroup

    public DefaultChannelGroup()

  Creates a new group with a generated name.

### DefaultChannelGroup

    public DefaultChannelGroup(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 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 `Collection<Channel>`
  Specified by:
    `isEmpty` in interface `Set<Channel>`
  Overrides:
    `isEmpty` in class `AbstractCollection<Channel>`

### size

    public int size()

  Specified by:
    `size` in interface `Collection<Channel>`
  Specified by:
    `size` in interface `Set<Channel>`
  Specified by:
    `size` in class `AbstractCollection<Channel>`

### find

    public Channel find(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(Object o)

  Specified by:
    `contains` in interface `Collection<Channel>`
  Specified by:
    `contains` in interface `Set<Channel>`
  Overrides:
    `contains` in class `AbstractCollection<Channel>`

### add

    public boolean add(Channel channel)

  Specified by:
    `add` in interface `Collection<Channel>`
  Specified by:
    `add` in interface `Set<Channel>`
  Overrides:
    `add` in class `AbstractCollection<Channel>`

### remove

    public boolean remove(Object o)

  Specified by:
    `remove` in interface `Collection<Channel>`
  Specified by:
    `remove` in interface `Set<Channel>`
  Overrides:
    `remove` in class `AbstractCollection<Channel>`

### clear

    public void clear()

  Specified by:
    `clear` in interface `Collection<Channel>`
  Specified by:
    `clear` in interface `Set<Channel>`
  Overrides:
    `clear` in class `AbstractCollection<Channel>`

### iterator

    public Iterator<Channel> iterator()

  Specified by:
    `iterator` in interface `Iterable<Channel>`
  Specified by:
    `iterator` in interface `Collection<Channel>`
  Specified by:
    `iterator` in interface `Set<Channel>`
  Specified by:
    `iterator` in class `AbstractCollection<Channel>`

### toArray

    public Object[] toArray()

  Specified by:
    `toArray` in interface `Collection<Channel>`
  Specified by:
    `toArray` in interface `Set<Channel>`
  Overrides:
    `toArray` in class `AbstractCollection<Channel>`

### toArray

    public <T> T[] toArray(T[] a)

  Specified by:
    `toArray` in interface `Collection<Channel>`
  Specified by:
    `toArray` in interface `Set<Channel>`
  Overrides:
    `toArray` in class `AbstractCollection<Channel>`

### close

    public ChannelGroupFuture close()

  Description copied from interface: `ChannelGroup`
  Closes all `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.

  Specified by:
    `close` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### disconnect

    public ChannelGroupFuture disconnect()

  Description copied from interface: `ChannelGroup`
  Disconnects all `Channel`s in this group from their remote peers.

  Specified by:
    `disconnect` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### setInterestOps

    public ChannelGroupFuture setInterestOps(int interestOps)

  Description copied from interface: `ChannelGroup`
  Calls `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.

  Specified by:
    `setInterestOps` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### setReadable

    public ChannelGroupFuture setReadable(boolean readable)

  Description copied from interface: `ChannelGroup`
  Calls `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.

  Specified by:
    `setReadable` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### unbind

    public ChannelGroupFuture unbind()

  Description copied from interface: `ChannelGroup`
  Unbinds all `Channel`s in this group from their local address.

  Specified by:
    `unbind` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### write

    public ChannelGroupFuture write(Object message)

  Description copied from interface: `ChannelGroup`
  Writes the specified `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.

  Specified by:
    `write` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### write

    public ChannelGroupFuture write(Object message,
                                    SocketAddress remoteAddress)

  Description copied from interface: `ChannelGroup`
  Writes the specified `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.

  Specified by:
    `write` in interface `ChannelGroup`
  Returns:
    the `ChannelGroupFuture` instance that notifies when the operation is done for all channels

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Collection<Channel>`
  Specified by:
    `hashCode` in interface `Set<Channel>`
  Overrides:
    `hashCode` in class `AbstractSet<Channel>`

### equals

    public boolean equals(Object o)

  Specified by:
    `equals` in interface `Collection<Channel>`
  Specified by:
    `equals` in interface `Set<Channel>`
  Overrides:
    `equals` in class `AbstractSet<Channel>`

### compareTo

    public int compareTo(ChannelGroup o)

  Specified by:
    `compareTo` in interface `Comparable<ChannelGroup>`

### toString

    public String toString()

  Overrides:
    `toString` in class `AbstractCollection<Channel>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.