|
XNIO API 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.xnio.Xnio
public abstract class Xnio

The XNIO entry point class.
| Constructor Summary | |
|---|---|
protected |
Xnio(XnioConfiguration configuration)
Construct an XNIO provider instance. |
| Method Summary | |
|---|---|
void |
awaken(Thread targetThread)
Wake up any blocking I/O operation being carried out on a given thread. |
abstract void |
close()
Close this XNIO provider. |
static Xnio |
create()
Create an instance of the default XNIO provider. |
static Xnio |
create(String implName,
XnioConfiguration configuration)
Create an instance of the named XNIO provider. |
static Xnio |
create(XnioConfiguration configuration)
Create an instance of the default XNIO provider. |
LocalDatagramConnector |
createLocalDatagramConnector(Executor executor,
OptionMap optionMap)
Create a local datagram connector. |
LocalDatagramConnector |
createLocalDatagramConnector(OptionMap optionMap)
Create a local datagram connector. |
LocalServer |
createLocalDatagramServer(ChannelListener<? super DatagramChannel<String>> openListener,
OptionMap optionMap)
Create a local datagram server. |
LocalServer |
createLocalDatagramServer(Executor executor,
ChannelListener<? super DatagramChannel<String>> openListener,
OptionMap optionMap)
Create a local datagram server. |
LocalStreamConnector |
createLocalStreamConnector(Executor executor,
OptionMap optionMap)
Create a local stream connector. |
LocalStreamConnector |
createLocalStreamConnector(OptionMap optionMap)
Create a local stream connector. |
LocalServer |
createLocalStreamServer(ChannelListener<? super ConnectedStreamChannel<String>> openListener,
OptionMap optionMap)
Create a local stream server. |
LocalServer |
createLocalStreamServer(Executor executor,
ChannelListener<? super ConnectedStreamChannel<String>> openListener,
OptionMap optionMap)
Create a local stream server. |
SocketFactory |
createManagedSocketFactory(OptionMap optionMap)
Create a managed socket factory which uses this provider's MBean configuration to track management information. |
IoFuture<? extends Closeable> |
createOneWayPipeConnection(ChannelListener<? super StreamSourceChannel> sourceListener,
ChannelListener<? super StreamSinkChannel> sinkListener)
Create a single one-way pipe connection. |
IoFuture<? extends Closeable> |
createOneWayPipeConnection(Executor executor,
ChannelListener<? super StreamSourceChannel> sourceListener,
ChannelListener<? super StreamSinkChannel> sinkListener)
Create a single one-way pipe connection. |
IoFuture<? extends Closeable> |
createPipeConnection(ChannelListener<? super StreamChannel> leftListener,
ChannelListener<? super StreamChannel> rightListener)
Create a single pipe connection. |
IoFuture<? extends Closeable> |
createPipeConnection(Executor executor,
ChannelListener<? super StreamChannel> leftListener,
ChannelListener<? super StreamChannel> rightListener)
Create a single pipe connection. |
ChannelSource<? extends StreamChannel> |
createPipeServer(ChannelListener<? super StreamChannel> openListener)
Create a pipe "server". |
ChannelSource<? extends StreamChannel> |
createPipeServer(Executor executor,
ChannelListener<? super StreamChannel> openListener)
Create a pipe "server". |
ChannelSource<? extends StreamSinkChannel> |
createPipeSinkServer(ChannelListener<? super StreamSourceChannel> openListener)
Create a one-way pipe "server". |
ChannelSource<? extends StreamSinkChannel> |
createPipeSinkServer(Executor executor,
ChannelListener<? super StreamSourceChannel> openListener)
Create a one-way pipe "server". |
ChannelSource<? extends StreamSourceChannel> |
createPipeSourceServer(ChannelListener<? super StreamSinkChannel> openListener)
Create a one-way pipe "server". |
ChannelSource<? extends StreamSourceChannel> |
createPipeSourceServer(Executor executor,
ChannelListener<? super StreamSinkChannel> openListener)
Create a one-way pipe "server". |
ServerSocketFactory |
createServerSocketFactory(OptionMap optionMap)
Create a managed server socket factory which uses this provider's MBean configuration to track management information. |
SslTcpConnector |
createSslTcpConnector(Executor executor,
InetSocketAddress src,
OptionMap optionMap)
Create an SSL TCP connector. |
SslTcpConnector |
createSslTcpConnector(InetSocketAddress src,
OptionMap optionMap)
Create an SSL TCP connector. |
SslTcpConnector |
createSslTcpConnector(OptionMap optionMap)
Create an SSL TCP connector. |
SslTcpServer |
createSslTcpServer(ChannelListener<? super SslTcpChannel> openListener,
OptionMap optionMap)
Create an unbound TCP SSL server. |
SslTcpServer |
createSslTcpServer(Executor executor,
ChannelListener<? super SslTcpChannel> openListener,
OptionMap optionMap)
Create an unbound TCP SSL server. |
SslTcpServer |
createSslTcpServer(OptionMap optionMap)
Create an unbound TCP SSL server. |
TcpAcceptor |
createTcpAcceptor(Executor executor,
OptionMap optionMap)
Create a TCP acceptor. |
TcpAcceptor |
createTcpAcceptor(OptionMap optionMap)
Create a TCP acceptor. |
TcpConnector |
createTcpConnector(Executor executor,
InetSocketAddress src,
OptionMap optionMap)
Create a TCP connector. |
TcpConnector |
createTcpConnector(Executor executor,
OptionMap optionMap)
Create a TCP connector. |
TcpConnector |
createTcpConnector(InetSocketAddress src,
OptionMap optionMap)
Create a TCP connector. |
TcpConnector |
createTcpConnector(OptionMap optionMap)
Create a TCP connector. |
TcpServer |
createTcpServer(ChannelListener<? super TcpChannel> openListener,
OptionMap optionMap)
Create an unbound TCP server. |
TcpServer |
createTcpServer(Executor executor,
ChannelListener<? super TcpChannel> openListener,
OptionMap optionMap)
Create an unbound TCP server. |
UdpServer |
createUdpServer(ChannelListener<? super UdpChannel> bindListener,
OptionMap optionMap)
Create an unbound UDP server. |
UdpServer |
createUdpServer(Executor executor,
ChannelListener<? super UdpChannel> bindListener,
OptionMap optionMap)
Create an unbound UDP server. |
UdpServer |
createUdpServer(OptionMap optionMap)
Create an unbound UDP server. |
protected Executor |
getExecutor()
Get the default listener executor. |
static Xnio |
getInstance()
Get the "default" instance. |
static Xnio |
getInstance(String name)
Get or create a named XNIO provider instance, which is automatically configured from a properties file. |
String |
getName()
Get the name of this XNIO instance. |
protected String |
getProperty(String name)
Get an XNIO property. |
protected String |
getProperty(String name,
String defaultValue)
Get an XNIO property. |
protected Closeable |
registerMBean(OneWayPipeConnectionMBean mBean)
Register a one-way pipe connection MBean. |
protected Closeable |
registerMBean(PipeConnectionMBean mBean)
Register a pipe connection MBean. |
protected Closeable |
registerMBean(PipeServerMBean mBean)
Register a pipe server MBean. |
protected Closeable |
registerMBean(PipeSinkServerMBean mBean)
Register a pipe sink server MBean. |
protected Closeable |
registerMBean(PipeSourceServerMBean mBean)
Register a pipe source server MBean. |
protected Closeable |
registerMBean(TcpConnectionMBean mBean)
Register a TCP connection MBean. |
protected Closeable |
registerMBean(TcpServerMBean mBean)
Register a TCP server MBean. |
protected Closeable |
registerMBean(UdpServerMBean mBean)
Register a UDP server MBean. |
String |
toString()
Get a string representation of this XNIO instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected Xnio(XnioConfiguration configuration)
| Method Detail |
|---|
protected Executor getExecutor()
public static Xnio getInstance(String name)
throws IOException
The boot classpath is searched for a file named "xnio.properties" (the name can be overridden by way of
the "xnio.property.file" system property). This file contains properties which are used to configure
all created providers.
The following properties are recognized:
<name>.listener.threadpool - a boolean value which specifies whether channel listeners should be invoked via
a thread pool executor. A value of true indicates that a thread pool should be created; a value of
false (the default) indicates that the listeners should be invoked from the current thread.<name>.listener.threadpool.coresize - an integer value which specifies the core size of the thread pool.
The default value is 8 threads.<name>.listener.threadpool.maxsize - an integer value which specifies the maximum size of the thread pool.
The default value is 64 threads.<name>.listener.threadpool.keepaliveseconds - an integer value which specifies the number of seconds an idle
thread should be kept alive before exiting. The default value is 30 seconds.<name>.listener.threadpool.queuelength - an integer value which specifies the length of the task queue for the
listener thread pool. The default value is 64.<name>.provider.option.<option-name> - An option to add to the XNIO provider's option map. The
value is the value for the option.<name>.provider - the provider implementation to use. If not specified, a default provider will be located and
used.
name - the provider name to get
IOException - if the XNIO provider could not be created
public static Xnio getInstance()
throws IOException
"default" instance. Equivalent to calling getInstance("default").
IOException - if the XNIO provider could not be created
public static Xnio create()
throws IOException
xnio.provider.name system property. Any failure to create the XNIO provider will cause an java.io.IOException
to be thrown.
IOException - if the XNIO provider could not be created
public static Xnio create(XnioConfiguration configuration)
throws IOException
xnio.provider.name system property. Any failure to create the XNIO provider will cause an java.io.IOException
to be thrown.
configuration - the configuration parameters for the implementation
IOException - if the XNIO provider could not be created
public static Xnio create(String implName,
XnioConfiguration configuration)
throws IOException
java.io.IOException
to be thrown.
implName - the name of the implementationconfiguration - the configuration parameters for the implementation
IOException - if the XNIO provider could not be createdpublic SocketFactory createManagedSocketFactory(OptionMap optionMap)
optionMap - the option map
public ServerSocketFactory createServerSocketFactory(OptionMap optionMap)
optionMap - the option map
public TcpServer createTcpServer(Executor executor,
ChannelListener<? super TcpChannel> openListener,
OptionMap optionMap)
executor - the executor to use to execute the listenersopenListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public TcpServer createTcpServer(ChannelListener<? super TcpChannel> openListener,
OptionMap optionMap)
openListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public SslTcpServer createSslTcpServer(Executor executor,
ChannelListener<? super SslTcpChannel> openListener,
OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
executor - the executor to use to execute the listenersopenListener - the initial open-connection listeneroptionMap - the initial configuration for the server
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public SslTcpServer createSslTcpServer(ChannelListener<? super SslTcpChannel> openListener,
OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
openListener - the initial open-connection listeneroptionMap - the initial configuration for the server
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public SslTcpServer createSslTcpServer(OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
optionMap - the initial configuration for the server
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public TcpConnector createTcpConnector(Executor executor,
OptionMap optionMap)
executor - the executor to use to execute the listenersoptionMap - the initial configuration for the connector
public TcpConnector createTcpConnector(OptionMap optionMap)
optionMap - the initial configuration for the connector
public TcpConnector createTcpConnector(Executor executor,
InetSocketAddress src,
OptionMap optionMap)
executor - the executor to use to execute the listenerssrc - the source address for connectionsoptionMap - the initial configuration for the connector
public TcpConnector createTcpConnector(InetSocketAddress src,
OptionMap optionMap)
src - the source address for connectionsoptionMap - the initial configuration for the connector
public SslTcpConnector createSslTcpConnector(Executor executor,
InetSocketAddress src,
OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
executor - the executor to use to execute the listenerssrc - the source address for connectionsoptionMap - the initial configuration for the connector
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public SslTcpConnector createSslTcpConnector(InetSocketAddress src,
OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
src - the source address for connectionsoptionMap - the initial configuration for the connector
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public SslTcpConnector createSslTcpConnector(OptionMap optionMap)
throws NoSuchProviderException,
NoSuchAlgorithmException
optionMap - the initial configuration for the connector
NoSuchProviderException - if an SSL provider was selected which is not supported
NoSuchAlgorithmException - if an SSL algorithm was selected which is not supported
public UdpServer createUdpServer(Executor executor,
ChannelListener<? super UdpChannel> bindListener,
OptionMap optionMap)
executor - the executor to use to execute the listenersbindListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public UdpServer createUdpServer(ChannelListener<? super UdpChannel> bindListener,
OptionMap optionMap)
bindListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public UdpServer createUdpServer(OptionMap optionMap)
optionMap - the initial configuration for the server
public ChannelSource<? extends StreamChannel> createPipeServer(Executor executor,
ChannelListener<? super StreamChannel> openListener)
executor - the executor to use to execute the listenersopenListener - the initial open-connection listener
public ChannelSource<? extends StreamChannel> createPipeServer(ChannelListener<? super StreamChannel> openListener)
openListener - the initial open-connection listener
public ChannelSource<? extends StreamSourceChannel> createPipeSourceServer(Executor executor,
ChannelListener<? super StreamSinkChannel> openListener)
executor - the executor to use to execute the listenersopenListener - the initial open-connection listener
public ChannelSource<? extends StreamSourceChannel> createPipeSourceServer(ChannelListener<? super StreamSinkChannel> openListener)
openListener - the initial open-connection listener
public ChannelSource<? extends StreamSinkChannel> createPipeSinkServer(Executor executor,
ChannelListener<? super StreamSourceChannel> openListener)
executor - the executor to use to execute the listenersopenListener - the initial open-connection listener
public ChannelSource<? extends StreamSinkChannel> createPipeSinkServer(ChannelListener<? super StreamSourceChannel> openListener)
openListener - the initial open-connection listener
public IoFuture<? extends Closeable> createPipeConnection(Executor executor,
ChannelListener<? super StreamChannel> leftListener,
ChannelListener<? super StreamChannel> rightListener)
executor - the executor to use to execute the listenersleftListener - the open listener for the "left" side of the piperightListener - the open listener for the "right" side of the pipe
public IoFuture<? extends Closeable> createPipeConnection(ChannelListener<? super StreamChannel> leftListener,
ChannelListener<? super StreamChannel> rightListener)
leftListener - the listener for the "left" side of the piperightListener - the listener for the "right" side of the pipe
public IoFuture<? extends Closeable> createOneWayPipeConnection(Executor executor,
ChannelListener<? super StreamSourceChannel> sourceListener,
ChannelListener<? super StreamSinkChannel> sinkListener)
executor - the executor to use to execute the listenerssourceListener - the listener for the "source" side of the pipesinkListener - the listener for the "sink" side of the pipe
public IoFuture<? extends Closeable> createOneWayPipeConnection(ChannelListener<? super StreamSourceChannel> sourceListener,
ChannelListener<? super StreamSinkChannel> sinkListener)
sourceListener - the listener for the "source" side of the pipesinkListener - the listener for the "sink" side of the pipe
public TcpAcceptor createTcpAcceptor(Executor executor,
OptionMap optionMap)
executor - the executor to use to execute the listenersoptionMap - the initial configuration for the acceptor
public TcpAcceptor createTcpAcceptor(OptionMap optionMap)
optionMap - the initial configuration for the acceptor
public LocalServer createLocalStreamServer(Executor executor,
ChannelListener<? super ConnectedStreamChannel<String>> openListener,
OptionMap optionMap)
executor - the executor to use to execute the listenersopenListener - a listener which is notified on channel openoptionMap - the initial configuration for the server
public LocalServer createLocalStreamServer(ChannelListener<? super ConnectedStreamChannel<String>> openListener,
OptionMap optionMap)
openListener - a listener which is notified on channel openoptionMap - the initial configuration for the server
public LocalStreamConnector createLocalStreamConnector(Executor executor,
OptionMap optionMap)
executor - the executor to use to execute the listenersoptionMap - the initial configuration for the connector
public LocalStreamConnector createLocalStreamConnector(OptionMap optionMap)
optionMap - the initial configuration for the connector
public LocalServer createLocalDatagramServer(Executor executor,
ChannelListener<? super DatagramChannel<String>> openListener,
OptionMap optionMap)
executor - the executor to use to execute the listenersopenListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public LocalServer createLocalDatagramServer(ChannelListener<? super DatagramChannel<String>> openListener,
OptionMap optionMap)
openListener - the initial open-connection listeneroptionMap - the initial configuration for the server
public LocalDatagramConnector createLocalDatagramConnector(Executor executor,
OptionMap optionMap)
executor - the executor to use to execute the listenersoptionMap - the initial configuration for the connector
public LocalDatagramConnector createLocalDatagramConnector(OptionMap optionMap)
optionMap - the initial configuration for the connector
public void awaken(Thread targetThread)
Thread
may call this method from their implementation of Thread.interrupt() after the default implementation
to ensure that any thread waiting in a blocking operation is woken up in a timely manner. Some implementations
may not implement this method, relying instead on the interruption mechanism built in to the JVM; as such this
method should not be relied upon as a guaranteed way to awaken a blocking thread independently of thread
interruption.
targetThread - the thread to awakenpublic String getName()
public String toString()
toString in class Object
public abstract void close()
throws IOException
close in interface CloseableIOExceptionprotected String getProperty(String name)
"xnio.".
name - the property name
null if it wasn't found
protected String getProperty(String name,
String defaultValue)
"xnio.".
name - the property namedefaultValue - the default value
defaultValue if it wasn't foundprotected Closeable registerMBean(TcpServerMBean mBean)
mBean - the MBean
protected Closeable registerMBean(TcpConnectionMBean mBean)
mBean - the MBean
protected Closeable registerMBean(UdpServerMBean mBean)
mBean - the MBean
protected Closeable registerMBean(OneWayPipeConnectionMBean mBean)
mBean - the MBean
protected Closeable registerMBean(PipeConnectionMBean mBean)
mBean - the MBean
protected Closeable registerMBean(PipeServerMBean mBean)
mBean - the MBean
protected Closeable registerMBean(PipeSourceServerMBean mBean)
mBean - the MBean
protected Closeable registerMBean(PipeSinkServerMBean mBean)
mBean - the MBean
|
XNIO API 2.1.0.CR2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||