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.apache.mina.common
Interface IoService

All Known Subinterfaces:
  IoAcceptor, IoConnector

All Known Implementing Classes:
  org.apache.mina.common.support.BaseIoAcceptor, org.apache.mina.common.support.BaseIoConnector, org.apache.mina.common.support.BaseIoService, DatagramAcceptor, DatagramConnector, org.apache.mina.common.support.DelegatedIoAcceptor, org.apache.mina.common.support.DelegatedIoConnector, SocketAcceptor, SocketConnector, VmPipeAcceptor, VmPipeConnector

    public interface IoService

Base interface for all `IoAcceptor`s and `IoConnector`s that provide I/O service and manage `IoSession`s.

Version:
  $Rev: 555855 $, $Date: 2007-07-13 05:19:00 +0200 (Fri, 13 Jul 2007) $
Author:
  The Apache Directory Project (mina-dev@directory.apache.org)

Method Summary
`void` | `addListener(IoServiceListener listener)` Adds an `IoServiceListener` that listens any events related with this service.
`IoServiceConfig` | `getDefaultConfig()` Returns the default configuration which is used when you didn't specify any configuration.
`DefaultIoFilterChainBuilder` | `getFilterChain()` A shortcut for `( ( DefaultIoFilterChainBuilder )` `getFilterChainBuilder()``)`.
`IoFilterChainBuilder` | `getFilterChainBuilder()` Returns the global `IoFilterChainBuilder` which will modify the `IoFilterChain` of all `IoSession`s which is managed by this service.
`Set<SocketAddress>` | `getManagedServiceAddresses()` Returns all `SocketAddress`es this service is managing.
`Set<IoSession>` | `getManagedSessions(SocketAddress serviceAddress)` Returns all sessions with the specified remote or local address, which are currently managed by this service.
`boolean` | `isManaged(SocketAddress serviceAddress)` Returns `true` if this service is managing the specified `serviceAddress`.
`void` | `removeListener(IoServiceListener listener)` Removed an existing `IoServiceListener` that listens any events related with this service.
`void` | `setFilterChainBuilder(IoFilterChainBuilder builder)` Sets the global `IoFilterChainBuilder` which will modify the `IoFilterChain` of all `IoSession`s which is managed by this service.

Method Detail

### addListener

    void addListener(IoServiceListener listener)

  Adds an `IoServiceListener` that listens any events related with this service.

### removeListener

    void removeListener(IoServiceListener listener)

  Removed an existing `IoServiceListener` that listens any events related with this service.

### getManagedServiceAddresses

    Set<SocketAddress> getManagedServiceAddresses()

  Returns all `SocketAddress`es this service is managing. If this service is an `IoAcceptor`, a set of bind addresses will be returned. If this service is an `IoConnector`, a set of remote addresses will be returned.

### isManaged

    boolean isManaged(SocketAddress serviceAddress)

  Returns `true` if this service is managing the specified `serviceAddress`. If this service is an `IoAcceptor`, `serviceAddress` is a bind address. If this service is an `IoConnector`, `serviceAddress` is a remote address.

### getManagedSessions

    Set<IoSession> getManagedSessions(SocketAddress serviceAddress)

  Returns all sessions with the specified remote or local address, which are currently managed by this service. `IoAcceptor` will assume the specified `address` is a local address, and `IoConnector` will assume it's a remote address.

  Parameters:
    `serviceAddress` - the address to return all sessions for.
  Returns:
    the sessions. An empty collection if there's no session.
  Throws:
    `IllegalArgumentException` - if the specified `address` has not been bound.
    `UnsupportedOperationException` - if this operation isn't supported for the particular transport type implemented by this `IoService`.

### getDefaultConfig

    IoServiceConfig getDefaultConfig()

  Returns the default configuration which is used when you didn't specify any configuration.

### getFilterChainBuilder

    IoFilterChainBuilder getFilterChainBuilder()

  Returns the global `IoFilterChainBuilder` which will modify the `IoFilterChain` of all `IoSession`s which is managed by this service. The default value is an empty `DefaultIoFilterChainBuilder`.

### setFilterChainBuilder

    void setFilterChainBuilder(IoFilterChainBuilder builder)

  Sets the global `IoFilterChainBuilder` which will modify the `IoFilterChain` of all `IoSession`s which is managed by this service. If you specify `null` this property will be set to an empty `DefaultIoFilterChainBuilder`.

### getFilterChain

    DefaultIoFilterChainBuilder getFilterChain()

  A shortcut for `( ( DefaultIoFilterChainBuilder )` `getFilterChainBuilder()``)`. Please note that the returned object is not a real `IoFilterChain` but a `DefaultIoFilterChainBuilder`. Modifying the returned builder won't affect the existing `IoSession`s at all, because `IoFilterChainBuilder`s affect only newly created `IoSession`s.

  Throws:
    `IllegalStateException` - if the current `IoFilterChainBuilder` is not a `DefaultIoFilterChainBuilder`

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 © 2004-2008 Apache MINA Project. All Rights Reserved.