org.apache.mina.transport.socket.nio

Class SocketAcceptor

Implemented Interfaces:
IoAcceptor, IoService

public class SocketAcceptor
extends BaseIoAcceptor

IoAcceptor for socket transport (TCP/IP).

Constructor Summary

SocketAcceptor()
Create an acceptor with a single processing thread using a NewThreadExecutor
SocketAcceptor(int processorCount, Executor executor)
Create an acceptor with the desired number of processing threads

Method Summary

void
bind(SocketAddress address, IoHandler handler, IoServiceConfig config)
Binds to the specified address and handles incoming connections with the specified handler.
SocketAcceptorConfig
getDefaultConfig()
void
setDefaultConfig(SocketAcceptorConfig defaultConfig)
Sets the config this acceptor will use by default.
void
unbind(SocketAddress address)
void
unbindAll()

Methods inherited from class org.apache.mina.common.support.BaseIoAcceptor

bind, newSession

Methods inherited from class org.apache.mina.common.support.BaseIoService

addListener, getFilterChain, getFilterChainBuilder, getListeners, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder

Constructor Details

SocketAcceptor

public SocketAcceptor()
Create an acceptor with a single processing thread using a NewThreadExecutor

SocketAcceptor

public SocketAcceptor(int processorCount,
                      Executor executor)
Create an acceptor with the desired number of processing threads
Parameters:
processorCount - Number of processing threads
executor - Executor to use for launching threads

Method Details

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. Backlog value is configured to the value of backlog property.
Specified by:
bind in interface IoAcceptor

getDefaultConfig

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

setDefaultConfig

public void setDefaultConfig(SocketAcceptorConfig defaultConfig)
Sets the config this acceptor will use by default.
Parameters:
defaultConfig - the default config.

unbind

public void unbind(SocketAddress address)
Specified by:
unbind in interface IoAcceptor

unbindAll

public void unbindAll()
Specified by:
unbindAll in interface IoAcceptor