|
XNIO version 1.2.0.GA | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.xnio.Xnio
org.jboss.xnio.nio.NioXnio
public final class NioXnio
An NIO-based XNIO provider for a standalone application.
Method Summary | |
---|---|
void |
awaken(Thread targetThread)
Wake up any blocking I/O operation being carried out on a given thread. |
void |
close()
Close this XNIO provider. |
static Xnio |
create()
Create an NIO-based XNIO provider. |
static Xnio |
create(Executor handlerExecutor,
int readSelectorThreads,
int writeSelectorThreads,
int connectSelectorThreads)
Create an NIO-based XNIO provider. |
static Xnio |
create(Executor handlerExecutor,
ThreadFactory selectorThreadFactory,
int readSelectorThreads,
int writeSelectorThreads,
int connectSelectorThreads)
Create an NIO-based XNIO provider. |
static Xnio |
create(int readSelectorThreads,
int writeSelectorThreads,
int connectSelectorThreads)
Create an NIO-based XNIO provider. |
static Xnio |
create(NioXnioConfiguration configuration)
Create an NIO-based XNIO provider. |
IoFuture<Closeable> |
createOneWayPipeConnection(Executor executor,
IoHandler<? super StreamSourceChannel> sourceHandler,
IoHandler<? super StreamSinkChannel> sinkHandler)
Create a single one-way pipe connection. |
IoFuture<Closeable> |
createOneWayPipeConnection(IoHandler<? super StreamSourceChannel> sourceHandler,
IoHandler<? super StreamSinkChannel> sinkHandler)
Create a single one-way pipe connection. |
IoFuture<Closeable> |
createPipeConnection(Executor executor,
IoHandler<? super StreamChannel> leftHandler,
IoHandler<? super StreamChannel> rightHandler)
Create a single pipe connection. |
IoFuture<Closeable> |
createPipeConnection(IoHandler<? super StreamChannel> leftHandler,
IoHandler<? super StreamChannel> rightHandler)
Create a single pipe connection. |
ChannelSource<StreamChannel> |
createPipeServer(Executor executor,
IoHandlerFactory<? super StreamChannel> handlerFactory)
Create a pipe "server". |
ChannelSource<StreamChannel> |
createPipeServer(IoHandlerFactory<? super StreamChannel> handlerFactory)
Create a pipe "server". |
ChannelSource<StreamSinkChannel> |
createPipeSinkServer(Executor executor,
IoHandlerFactory<? super StreamSourceChannel> handlerFactory)
Create a one-way pipe "server". |
ChannelSource<StreamSinkChannel> |
createPipeSinkServer(IoHandlerFactory<? super StreamSourceChannel> handlerFactory)
Create a one-way pipe "server". |
ChannelSource<StreamSourceChannel> |
createPipeSourceServer(Executor executor,
IoHandlerFactory<? super StreamSinkChannel> handlerFactory)
Create a one-way pipe "server". |
ChannelSource<StreamSourceChannel> |
createPipeSourceServer(IoHandlerFactory<? super StreamSinkChannel> handlerFactory)
Create a one-way pipe "server". |
ConfigurableFactory<CloseableTcpAcceptor> |
createTcpAcceptor()
Create a TCP acceptor. |
ConfigurableFactory<CloseableTcpAcceptor> |
createTcpAcceptor(Executor executor)
Create a TCP acceptor. |
ConfigurableFactory<CloseableTcpConnector> |
createTcpConnector()
Create a configurable TCP connector. |
ConfigurableFactory<CloseableTcpConnector> |
createTcpConnector(Executor executor)
Create a configurable TCP connector. |
ConfigurableFactory<BoundServer<SocketAddress,BoundChannel<SocketAddress>>> |
createTcpServer(Executor executor,
IoHandlerFactory<? super TcpChannel> handlerFactory,
SocketAddress... bindAddresses)
Create a TCP server. |
ConfigurableFactory<BoundServer<SocketAddress,BoundChannel<SocketAddress>>> |
createTcpServer(IoHandlerFactory<? super TcpChannel> handlerFactory,
SocketAddress... bindAddresses)
Create a TCP server. |
ConfigurableFactory<BoundServer<SocketAddress,UdpChannel>> |
createUdpServer(boolean multicast,
IoHandlerFactory<? super UdpChannel> handlerFactory,
SocketAddress... bindAddresses)
Create a UDP server. |
ConfigurableFactory<BoundServer<SocketAddress,UdpChannel>> |
createUdpServer(Executor executor,
boolean multicast,
IoHandlerFactory<? super UdpChannel> handlerFactory,
SocketAddress... bindAddresses)
Create a UDP server. |
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 org.jboss.xnio.Xnio |
---|
createLocalDatagramConnector, createLocalDatagramConnector, createLocalDatagramServer, createLocalDatagramServer, createLocalStreamConnector, createLocalStreamConnector, createLocalStreamServer, createLocalStreamServer, getName, getProperty, getProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Xnio create(NioXnioConfiguration configuration) throws IOException
configuration
- the configuration
IOException
- if an I/O error occurs while starting the servicepublic static Xnio create() throws IOException
IOException
- if an I/O error occurs while starting the servicepublic static Xnio create(int readSelectorThreads, int writeSelectorThreads, int connectSelectorThreads) throws IOException, IllegalArgumentException
readSelectorThreads
- the number of threads to assign for readable eventswriteSelectorThreads
- the number of threads to assign for writable eventsconnectSelectorThreads
- the number of threads to assign for connect/accept events
IOException
- if an I/O error occurs while starting the service
IllegalArgumentException
- if a given argument is not validpublic static Xnio create(Executor handlerExecutor, int readSelectorThreads, int writeSelectorThreads, int connectSelectorThreads) throws IOException, IllegalArgumentException
handlerExecutor
- the executor to use to handle eventsreadSelectorThreads
- the number of threads to assign for readable eventswriteSelectorThreads
- the number of threads to assign for writable eventsconnectSelectorThreads
- the number of threads to assign for connect/accept events
IOException
- if an I/O error occurs while starting the service
IllegalArgumentException
- if a given argument is not validpublic static Xnio create(Executor handlerExecutor, ThreadFactory selectorThreadFactory, int readSelectorThreads, int writeSelectorThreads, int connectSelectorThreads) throws IOException, IllegalArgumentException
handlerExecutor
- the executor to use to handle eventsselectorThreadFactory
- the selector thread factory to usereadSelectorThreads
- the number of threads to assign for readable eventswriteSelectorThreads
- the number of threads to assign for writable eventsconnectSelectorThreads
- the number of threads to assign for connect/accept events
IOException
- if an I/O error occurs while starting the service
IllegalArgumentException
- if a given argument is not validpublic ConfigurableFactory<BoundServer<SocketAddress,BoundChannel<SocketAddress>>> createTcpServer(Executor executor, IoHandlerFactory<? super TcpChannel> handlerFactory, SocketAddress... bindAddresses)
createTcpServer
in class Xnio
executor
- the executor to use to execute the handlershandlerFactory
- the factory which will produce handlers for inbound connectionsbindAddresses
- the addresses to bind to
public ConfigurableFactory<BoundServer<SocketAddress,BoundChannel<SocketAddress>>> createTcpServer(IoHandlerFactory<? super TcpChannel> handlerFactory, SocketAddress... bindAddresses)
createTcpServer
in class Xnio
handlerFactory
- the factory which will produce handlers for inbound connectionsbindAddresses
- the addresses to bind to
public ConfigurableFactory<CloseableTcpConnector> createTcpConnector(Executor executor)
createTcpConnector
in class Xnio
executor
- the executor to use to execute the handlers
public ConfigurableFactory<CloseableTcpConnector> createTcpConnector()
createTcpConnector
in class Xnio
public ConfigurableFactory<BoundServer<SocketAddress,UdpChannel>> createUdpServer(Executor executor, boolean multicast, IoHandlerFactory<? super UdpChannel> handlerFactory, SocketAddress... bindAddresses)
createUdpServer
in class Xnio
executor
- the executor to use to execute the handlersmulticast
- true
if the UDP server should be multicast-capablehandlerFactory
- the factory which will produce handlers for each channelbindAddresses
- the addresses to bind
public ConfigurableFactory<BoundServer<SocketAddress,UdpChannel>> createUdpServer(boolean multicast, IoHandlerFactory<? super UdpChannel> handlerFactory, SocketAddress... bindAddresses)
createUdpServer
in class Xnio
multicast
- true
if the UDP server should be multicast-capablehandlerFactory
- the factory which will produce handlers for each channelbindAddresses
- the addresses to bind
public ChannelSource<StreamChannel> createPipeServer(Executor executor, IoHandlerFactory<? super StreamChannel> handlerFactory)
createPipeServer
in class Xnio
executor
- the executor to use to execute the handlershandlerFactory
- the server handler factory
public ChannelSource<StreamChannel> createPipeServer(IoHandlerFactory<? super StreamChannel> handlerFactory)
createPipeServer
in class Xnio
handlerFactory
- the server handler factory
public ChannelSource<StreamSourceChannel> createPipeSourceServer(Executor executor, IoHandlerFactory<? super StreamSinkChannel> handlerFactory)
createPipeSourceServer
in class Xnio
executor
- the executor to use to execute the handlershandlerFactory
- the server handler factory
public ChannelSource<StreamSourceChannel> createPipeSourceServer(IoHandlerFactory<? super StreamSinkChannel> handlerFactory)
createPipeSourceServer
in class Xnio
handlerFactory
- the server handler factory
public ChannelSource<StreamSinkChannel> createPipeSinkServer(Executor executor, IoHandlerFactory<? super StreamSourceChannel> handlerFactory)
createPipeSinkServer
in class Xnio
executor
- the executor to use to execute the handlershandlerFactory
- the server handler factory
public ChannelSource<StreamSinkChannel> createPipeSinkServer(IoHandlerFactory<? super StreamSourceChannel> handlerFactory)
createPipeSinkServer
in class Xnio
handlerFactory
- the server handler factory
public IoFuture<Closeable> createPipeConnection(Executor executor, IoHandler<? super StreamChannel> leftHandler, IoHandler<? super StreamChannel> rightHandler)
createPipeConnection
in class Xnio
executor
- the executor to use to execute the handlersleftHandler
- the handler for the "left" side of the piperightHandler
- the handler for the "right" side of the pipe
public IoFuture<Closeable> createPipeConnection(IoHandler<? super StreamChannel> leftHandler, IoHandler<? super StreamChannel> rightHandler)
createPipeConnection
in class Xnio
leftHandler
- the handler for the "left" side of the piperightHandler
- the handler for the "right" side of the pipe
public IoFuture<Closeable> createOneWayPipeConnection(Executor executor, IoHandler<? super StreamSourceChannel> sourceHandler, IoHandler<? super StreamSinkChannel> sinkHandler)
createOneWayPipeConnection
in class Xnio
executor
- the executor to use to execute the handlerssourceHandler
- the handler for the "source" side of the pipesinkHandler
- the handler for the "sink" side of the pipe
public IoFuture<Closeable> createOneWayPipeConnection(IoHandler<? super StreamSourceChannel> sourceHandler, IoHandler<? super StreamSinkChannel> sinkHandler)
createOneWayPipeConnection
in class Xnio
sourceHandler
- the handler for the "source" side of the pipesinkHandler
- the handler for the "sink" side of the pipe
public ConfigurableFactory<CloseableTcpAcceptor> createTcpAcceptor(Executor executor)
createTcpAcceptor
in class Xnio
executor
- the executor to use to execute the handlers
public ConfigurableFactory<CloseableTcpAcceptor> createTcpAcceptor()
createTcpAcceptor
in class Xnio
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. This implementation relies on NIO mechanisms to awaken interrupted threads.
awaken
in class Xnio
targetThread
- the thread to awakenpublic void close() throws IOException
close
in interface Closeable
close
in class Xnio
IOException
public String toString()
Xnio
toString
in class Xnio
protected Closeable registerMBean(TcpServerMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(TcpConnectionMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(UdpServerMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(OneWayPipeConnectionMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(PipeConnectionMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(PipeServerMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(PipeSourceServerMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
protected Closeable registerMBean(PipeSinkServerMBean mBean)
Xnio
registerMBean
in class Xnio
mBean
- the MBean
|
XNIO version 1.2.0.GA | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |