Class SocketAcceptor
java.lang.Object
org.apache.mina.common.support.BaseIoService
org.apache.mina.common.support.BaseIoAcceptor
org.apache.mina.transport.socket.nio.SocketAcceptor
- All Implemented Interfaces:
IoAcceptor,IoService
IoAcceptor for socket transport (TCP/IP).-
Constructor Summary
ConstructorsConstructorDescriptionCreate an acceptor with a single processing thread using a NewThreadExecutorSocketAcceptor(int processorCount, Executor executor) Create an acceptor with the desired number of processing threads -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(SocketAddress address, IoHandler handler, IoServiceConfig config) Binds to the specifiedaddressand handles incoming connections with the specifiedhandler.Returns the default configuration which is used when you didn't specify any configuration.voidsetDefaultConfig(SocketAcceptorConfig defaultConfig) Sets the config this acceptor will use by default.voidunbind(SocketAddress address) Unbinds from the specifiedaddressand disconnects all clients connected there.voidUnbinds all addresses which were bound by this acceptor.Methods inherited from class org.apache.mina.common.support.BaseIoAcceptor
bind, newSessionMethods inherited from class org.apache.mina.common.support.BaseIoService
addListener, getFilterChain, getFilterChainBuilder, getListeners, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.mina.common.IoService
addListener, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder
-
Constructor Details
-
SocketAcceptor
public SocketAcceptor()Create an acceptor with a single processing thread using a NewThreadExecutor -
SocketAcceptor
Create an acceptor with the desired number of processing threads- Parameters:
processorCount- Number of processing threadsexecutor- Executor to use for launching threads
-
-
Method Details
-
bind
public void bind(SocketAddress address, IoHandler handler, IoServiceConfig config) throws IOException Binds to the specifiedaddressand handles incoming connections with the specifiedhandler. Backlog value is configured to the value ofbacklogproperty.config- the configuration- Throws:
IOException- if failed to bind
-
unbind
Description copied from interface:IoAcceptorUnbinds from the specifiedaddressand disconnects all clients connected there. -
unbindAll
public void unbindAll()Description copied from interface:IoAcceptorUnbinds all addresses which were bound by this acceptor. -
getDefaultConfig
Description copied from interface:IoServiceReturns the default configuration which is used when you didn't specify any configuration. -
setDefaultConfig
Sets the config this acceptor will use by default.- Parameters:
defaultConfig- the default config.- Throws:
NullPointerException- if the specified value isnull.
-