org.apache.mina.common.support

Class DelegatedIoAcceptor

Implemented Interfaces:
IoAcceptor, IoService
Known Direct Subclasses:
DatagramAcceptor

public class DelegatedIoAcceptor
extends java.lang.Object
implements IoAcceptor

A delegated IoAcceptor that wraps the other IoAcceptor.

Field Summary

protected IoAcceptor
delegate

Constructor Summary

DelegatedIoAcceptor()
Creates a new instance.

Method Summary

void
addListener(IoServiceListener listener)
void
bind(SocketAddress address, IoHandler handler)
Binds to the specified address and handles incoming connections with the specified handler.
void
bind(SocketAddress address, IoHandler handler, IoServiceConfig config)
Binds to the specified address and handles incoming connections with the specified handler.
IoServiceConfig
getDefaultConfig()
DefaultIoFilterChainBuilder
getFilterChain()
IoFilterChainBuilder
getFilterChainBuilder()
Set
getManagedServiceAddresses()
Set
getManagedSessions(SocketAddress serviceAddress)
protected void
init(IoAcceptor delegate)
Sets the delegate.
boolean
isManaged(SocketAddress address)
IoSession
newSession(SocketAddress remoteAddress, SocketAddress localAddress)
(Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via IoAcceptor.bind(SocketAddress,IoHandler).
void
removeListener(IoServiceListener listener)
void
setFilterChainBuilder(IoFilterChainBuilder builder)
void
unbind(SocketAddress address)
Unbinds from the specified address and disconnects all clients connected there.
void
unbindAll()
Unbinds all addresses which were bound by this acceptor.

Field Details

delegate

protected IoAcceptor delegate

Constructor Details

DelegatedIoAcceptor

protected DelegatedIoAcceptor()
Creates a new instance.

Method Details

addListener

public void addListener(IoServiceListener listener)
Specified by:
addListener in interface IoService

bind

public void bind(SocketAddress address,
                 IoHandler handler)
            throws IOException
Binds to the specified address and handles incoming connections with the specified handler.
Specified by:
bind in interface IoAcceptor

bind

public void bind(SocketAddress address,
                 IoHandler handler,
                 IoServiceConfig config)
            throws IOException
Binds to the specified address and handles incoming connections with the specified handler.
Specified by:
bind in interface IoAcceptor
Parameters:
config - the configuration

getDefaultConfig

public IoServiceConfig getDefaultConfig()
Specified by:
getDefaultConfig in interface IoService

getFilterChain

public DefaultIoFilterChainBuilder getFilterChain()
Specified by:
getFilterChain in interface IoService

getFilterChainBuilder

public IoFilterChainBuilder getFilterChainBuilder()
Specified by:
getFilterChainBuilder in interface IoService

getManagedServiceAddresses

public Set getManagedServiceAddresses()
Specified by:
getManagedServiceAddresses in interface IoService

getManagedSessions

public Set getManagedSessions(SocketAddress serviceAddress)
Specified by:
getManagedSessions in interface IoService

init

protected void init(IoAcceptor delegate)
Sets the delegate. This method should be invoked before any operations is requested.

isManaged

public boolean isManaged(SocketAddress address)
Specified by:
isManaged in interface IoService

newSession

public IoSession newSession(SocketAddress remoteAddress,
                            SocketAddress localAddress)
(Optional) Returns an IoSession that is bound to the specified localAddress and remoteAddress which reuses the localAddress that is already bound by IoAcceptor via IoAcceptor.bind(SocketAddress,IoHandler).

This operation is optional. Please throw UnsupportedOperationException if the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.

Specified by:
newSession in interface IoAcceptor

removeListener

public void removeListener(IoServiceListener listener)
Specified by:
removeListener in interface IoService

setFilterChainBuilder

public void setFilterChainBuilder(IoFilterChainBuilder builder)
Specified by:
setFilterChainBuilder in interface IoService

unbind

public void unbind(SocketAddress address)
Unbinds from the specified address and disconnects all clients connected there.
Specified by:
unbind in interface IoAcceptor

unbindAll

public void unbindAll()
Unbinds all addresses which were bound by this acceptor.
Specified by:
unbindAll in interface IoAcceptor