public abstract class NioServerSocketChannelFactory extends Object implements Cloneable
NioServerSocketChannelFactory
Created on Jan 3, 2012 at 12:08:30 PMModifier and Type | Field and Description |
---|---|
protected Hashtable<String,Object> |
attributes |
protected AsynchronousChannelGroup |
threadGroup |
Modifier | Constructor and Description |
---|---|
protected |
NioServerSocketChannelFactory()
Create a new instance of
NioServerSocketChannelFactory |
protected |
NioServerSocketChannelFactory(AsynchronousChannelGroup threadGroup)
Create a new instance of
NioServerSocketChannelFactory |
Modifier and Type | Method and Description |
---|---|
abstract NioChannel |
acceptChannel(AsynchronousServerSocketChannel listener)
Wrapper function for accept().
|
static NioServerSocketChannelFactory |
createSecureFactory(AsynchronousChannelGroup threadGroup)
Create and configure a new secure
NioServerSocketChannelFactory
instance |
AsynchronousServerSocketChannel |
createServerChannel(int port)
Returns a server socket channel which uses all network interfaces on the
host, and is bound to a the specified port.
|
AsynchronousServerSocketChannel |
createServerChannel(int port,
int backlog)
Returns a server socket which uses all network interfaces on the host, is
bound to a the specified port, and uses the specified connection backlog.
|
abstract AsynchronousServerSocketChannel |
createServerChannel(int port,
int backlog,
InetAddress ifAddress,
boolean reuseAddress)
Returns a server socket channel which uses only the specified network
interface on the local host, is bound to a the specified port, and uses
the specified connection backlog.
|
static NioServerSocketChannelFactory |
createServerSocketChannelFactory(AsynchronousChannelGroup threadGroup,
boolean secure)
Create a new
NioServerSocketChannelFactory instance |
abstract void |
destroy()
Destroy the factory
|
static NioServerSocketChannelFactory |
getDefault()
Returns a copy of the environment's default socket factory.
|
static NioServerSocketChannelFactory |
getDefault(AsynchronousChannelGroup threadGroup)
Returns a copy of the environment's default socket factory.
|
abstract void |
handshake(NioChannel channel)
Extra function to initiate the handshake.
|
abstract void |
init()
Initialize the factory
|
abstract void |
initChannel(NioChannel channel)
Initialize the specified
NioChannel |
protected AsynchronousServerSocketChannel |
open()
Open an
AsynchronousServerSocketChannel |
void |
setAttribute(String name,
Object value)
General mechanism to pass attributes from the ServerConnector to the
socket factory.
|
protected AsynchronousChannelGroup threadGroup
protected NioServerSocketChannelFactory()
NioServerSocketChannelFactory
protected NioServerSocketChannelFactory(AsynchronousChannelGroup threadGroup)
NioServerSocketChannelFactory
threadGroup
- public abstract void init() throws IOException
IOException
public abstract void destroy() throws IOException
IOException
public void setAttribute(String name, Object value)
name
- value
- public static NioServerSocketChannelFactory getDefault()
public static NioServerSocketChannelFactory getDefault(AsynchronousChannelGroup threadGroup)
threadGroup
- public static NioServerSocketChannelFactory createSecureFactory(AsynchronousChannelGroup threadGroup)
NioServerSocketChannelFactory
instancethreadGroup
- the thread group that will be used with the server socketsNioServerSocketChannelFactory
instancepublic static NioServerSocketChannelFactory createServerSocketChannelFactory(AsynchronousChannelGroup threadGroup, boolean secure)
NioServerSocketChannelFactory
instancethreadGroup
- the thread group that will be used with the server socketssecure
- NioServerSocketChannelFactory
instancepublic AsynchronousServerSocketChannel createServerChannel(int port) throws IOException
port
- the port to listen toAsynchronousServerSocketChannel
IOException
- for networking errorspublic AsynchronousServerSocketChannel createServerChannel(int port, int backlog) throws IOException
port
- the port to listen tobacklog
- how many connections are queuedAsynchronousServerSocketChannel
IOException
- for networking errorspublic abstract AsynchronousServerSocketChannel createServerChannel(int port, int backlog, InetAddress ifAddress, boolean reuseAddress) throws IOException
port
- the port to listen tobacklog
- how many connections are queuedifAddress
- the network interface address to usereuseAddress
- AsynchronousServerSocketChannel
IOException
- for networking errorspublic abstract void initChannel(NioChannel channel) throws Exception
NioChannel
channel
- The channel to be initializedException
public abstract NioChannel acceptChannel(AsynchronousServerSocketChannel listener) throws IOException
listener
- The Asynchronous Server Socket channel that will accept a new
connectionNioChannel
representing the new connectionIOException
public abstract void handshake(NioChannel channel) throws IOException
channel
- IOException
protected AsynchronousServerSocketChannel open() throws IOException
AsynchronousServerSocketChannel
AsynchronousServerSocketChannel
IOException
Copyright © 2014 JBoss by Red Hat. All rights reserved.