public class SocketAcceptor extends BaseIoAcceptor
IoAcceptor for socket transport (TCP/IP).| 构造器和说明 |
|---|
SocketAcceptor()
Create an acceptor with a single processing thread using a NewThreadExecutor
|
SocketAcceptor(int processorCount,
java.util.concurrent.Executor executor)
Create an acceptor with the desired number of processing threads
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
bind(java.net.SocketAddress address,
IoHandler handler,
IoServiceConfig config)
Binds to the specified
address and handles incoming connections with the specified
handler. |
SocketAcceptorConfig |
getDefaultConfig()
Returns the default configuration which is used when you didn't specify
any configuration.
|
void |
setDefaultConfig(SocketAcceptorConfig defaultConfig)
Sets the config this acceptor will use by default.
|
void |
unbind(java.net.SocketAddress address)
Unbinds from the specified
address and disconnects all clients
connected there. |
void |
unbindAll()
Unbinds all addresses which were bound by this acceptor.
|
bind, newSessionaddListener, getFilterChain, getFilterChainBuilder, getListeners, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilderpublic SocketAcceptor()
public SocketAcceptor(int processorCount,
java.util.concurrent.Executor executor)
processorCount - Number of processing threadsexecutor - Executor to use for launching threadspublic void bind(java.net.SocketAddress address,
IoHandler handler,
IoServiceConfig config)
throws java.io.IOException
address and handles incoming connections with the specified
handler. Backlog value is configured to the value of backlog property.config - the configurationjava.io.IOException - if failed to bindpublic void unbind(java.net.SocketAddress address)
IoAcceptoraddress and disconnects all clients
connected there.public void unbindAll()
IoAcceptorpublic SocketAcceptorConfig getDefaultConfig()
IoServicepublic void setDefaultConfig(SocketAcceptorConfig defaultConfig)
defaultConfig - the default config.java.lang.NullPointerException - if the specified value is null.