public abstract class AbstractAsyncServer extends Object implements ProtocolServer
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_IO_WORKER_COUNT |
| Constructor and Description |
|---|
AbstractAsyncServer() |
| Modifier and Type | Method and Description |
|---|---|
void |
bind()
Start the server
|
protected void |
configureBootstrap(org.jboss.netty.bootstrap.ServerBootstrap bootstrap)
Configure the bootstrap before it get bound
|
protected Executor |
createBossExecutor()
Create a new
Executor used for dispatch messages to the workers. |
protected abstract org.jboss.netty.channel.ChannelPipelineFactory |
createPipelineFactory(org.jboss.netty.channel.group.ChannelGroup group)
Create ChannelPipelineFactory to use by this Server implementation
|
protected org.jboss.netty.channel.socket.ServerSocketChannelFactory |
createSocketChannelFactory() |
protected Executor |
createWorkerExecutor()
Create a new
Executor used for workers. |
int |
getBacklog()
Return the backlog for the socket
|
int |
getIoWorkerCount()
Return the IO worker thread count to use
|
List<InetSocketAddress> |
getListenAddresses()
Return the ips on which the server listen for connections
|
int |
getTimeout()
Return the read/write timeout in seconds for the socket.
|
boolean |
isBound()
return true if the server is bound
|
void |
setBacklog(int backlog)
Set the Backlog for the socket.
|
void |
setIoWorkerCount(int ioWorker)
Set the IO-worker thread count to use.
|
void |
setListenAddresses(InetSocketAddress... addresses) |
void |
setTimeout(int timeout)
Set the read/write timeout for the server.
|
void |
unbind()
Stop the server
|
public void setListenAddresses(InetSocketAddress... addresses)
public void setIoWorkerCount(int ioWorker)
ioWorker - public int getIoWorkerCount()
public void bind()
throws Exception
ProtocolServerbind in interface ProtocolServerExceptionprotected void configureBootstrap(org.jboss.netty.bootstrap.ServerBootstrap bootstrap)
bootstrap - protected org.jboss.netty.channel.socket.ServerSocketChannelFactory createSocketChannelFactory()
public void unbind()
ProtocolServerunbind in interface ProtocolServerpublic List<InetSocketAddress> getListenAddresses()
ProtocolServergetListenAddresses in interface ProtocolServerprotected abstract org.jboss.netty.channel.ChannelPipelineFactory createPipelineFactory(org.jboss.netty.channel.group.ChannelGroup group)
public void setTimeout(int timeout)
IllegalStateException if the
server is running.timeout - public void setBacklog(int backlog)
IllegalStateException if the server is running.backlog - public int getBacklog()
ProtocolServergetBacklog in interface ProtocolServerpublic int getTimeout()
ProtocolServergetTimeout in interface ProtocolServerprotected Executor createBossExecutor()
Executor used for dispatch messages to the workers. One Thread will be used per port which is bound.
This can get overridden if needed, by default it use a Executors.newCachedThreadPool()protected Executor createWorkerExecutor()
Executor used for workers. This can get overridden if needed, by default it use a Executors.newCachedThreadPool()public boolean isBound()
ProtocolServerisBound in interface ProtocolServerCopyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.