
public abstract class XnioWorker extends java.util.concurrent.AbstractExecutorService implements Configurable, java.util.concurrent.ExecutorService
| Modifier | Constructor and Description |
|---|---|
protected |
XnioWorker(Xnio xnio,
java.lang.ThreadGroup threadGroup,
OptionMap optionMap,
java.lang.Runnable terminationTask)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
IoFuture<ConnectedMessageChannel> |
acceptDatagram(java.net.SocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Accept a message connection at a destination address.
|
protected IoFuture<ConnectedMessageChannel> |
acceptLocalDatagram(LocalSocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to accept a local (UNIX domain) datagram connection.
|
protected IoFuture<ConnectedStreamChannel> |
acceptLocalStream(LocalSocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to accept a local (UNIX domain) stream connection.
|
IoFuture<ConnectedStreamChannel> |
acceptStream(java.net.SocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Accept a stream connection at a destination address.
|
protected IoFuture<ConnectedStreamChannel> |
acceptTcpStream(java.net.InetSocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to accept a TCP connection.
|
abstract boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
IoFuture<ConnectedMessageChannel> |
connectDatagram(java.net.SocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Connect to a remote stream server.
|
IoFuture<ConnectedMessageChannel> |
connectDatagram(java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Connect to a remote datagram server.
|
protected IoFuture<ConnectedMessageChannel> |
connectLocalDatagram(LocalSocketAddress bindAddress,
LocalSocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to connect to a local (UNIX domain) datagram server.
|
protected IoFuture<ConnectedStreamChannel> |
connectLocalStream(LocalSocketAddress bindAddress,
LocalSocketAddress destinationAddress,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to connect to a local (UNIX domain) server.
|
IoFuture<ConnectedStreamChannel> |
connectStream(java.net.SocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Connect to a remote stream server.
|
IoFuture<ConnectedStreamChannel> |
connectStream(java.net.SocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
OptionMap optionMap)
Connect to a remote stream server.
|
IoFuture<ConnectedStreamChannel> |
connectStream(java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Connect to a remote stream server.
|
protected IoFuture<ConnectedStreamChannel> |
connectTcpStream(java.net.InetSocketAddress bindAddress,
java.net.InetSocketAddress destinationAddress,
ChannelListener<? super ConnectedStreamChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to connect to a TCP server.
|
protected IoFuture<ConnectedMessageChannel> |
connectUdpDatagram(java.net.InetSocketAddress bindAddress,
java.net.InetSocketAddress destination,
ChannelListener<? super ConnectedMessageChannel> openListener,
ChannelListener<? super BoundChannel> bindListener,
OptionMap optionMap)
Implementation helper method to connect to a UDP server.
|
protected AcceptingChannel<? extends ConnectedStreamChannel> |
createLocalStreamServer(LocalSocketAddress bindAddress,
ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener,
OptionMap optionMap)
Implementation helper method to create a UNIX domain stream server.
|
void |
createOneWayPipe(ChannelListener<? super StreamSourceChannel> sourceListener,
ChannelListener<? super StreamSinkChannel> sinkListener,
OptionMap optionMap)
Open a unidirectional stream pipe.
|
void |
createPipe(ChannelListener<? super StreamChannel> leftOpenListener,
ChannelListener<? super StreamChannel> rightOpenListener,
OptionMap optionMap)
Open a bidirectional stream pipe.
|
AcceptingChannel<? extends ConnectedStreamChannel> |
createStreamServer(java.net.SocketAddress bindAddress,
ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener,
OptionMap optionMap)
Create a stream server, for TCP or UNIX domain servers.
|
protected AcceptingChannel<? extends ConnectedStreamChannel> |
createTcpServer(java.net.InetSocketAddress bindAddress,
ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener,
OptionMap optionMap)
Implementation helper method to create a TCP stream server.
|
MulticastMessageChannel |
createUdpServer(java.net.InetSocketAddress bindAddress,
ChannelListener<? super MulticastMessageChannel> bindListener,
OptionMap optionMap)
Create a UDP server.
|
MulticastMessageChannel |
createUdpServer(java.net.InetSocketAddress bindAddress,
OptionMap optionMap)
Create a UDP server.
|
void |
execute(java.lang.Runnable command)
Execute a command in the task pool.
|
java.lang.String |
getName()
Get the name of this worker.
|
<T> T |
getOption(Option<T> option)
Get the value of a channel option.
|
protected java.lang.Runnable |
getTerminationTask()
Get the user task to run once termination is complete.
|
Xnio |
getXnio()
Get the XNIO provider which produced this worker.
|
abstract boolean |
isShutdown() |
abstract boolean |
isTerminated() |
<T> T |
setOption(Option<T> option,
T value)
Set an option for this channel.
|
abstract void |
shutdown() |
abstract java.util.List<java.lang.Runnable> |
shutdownNow() |
protected void |
shutDownTaskPool()
Initiate shutdown of the task thread pool.
|
protected java.util.List<java.lang.Runnable> |
shutDownTaskPoolNow()
Shut down the task thread pool immediately and return its pending tasks.
|
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
protected void |
taskPoolTerminated()
Callback to indicate that the task thread pool has terminated.
|
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitprotected XnioWorker(Xnio xnio, java.lang.ThreadGroup threadGroup, OptionMap optionMap, java.lang.Runnable terminationTask)
Xnio.createWorker(OptionMap) method.xnio - the XNIO provider which produced this worker instancethreadGroup - the thread group for worker threadsoptionMap - the option map to use to configure this workerterminationTask - an optional runnable task to run when the worker shutdown completespublic AcceptingChannel<? extends ConnectedStreamChannel> createStreamServer(java.net.SocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener, OptionMap optionMap) throws java.io.IOException
bindAddress - the address to bind toacceptListener - the initial accept listeneroptionMap - the initial configuration for the serverjava.io.IOException - if the server could not be createdprotected AcceptingChannel<? extends ConnectedStreamChannel> createTcpServer(java.net.InetSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener, OptionMap optionMap) throws java.io.IOException
bindAddress - the address to bind toacceptListener - the initial accept listeneroptionMap - the initial configuration for the serverjava.io.IOException - if the server could not be createdprotected AcceptingChannel<? extends ConnectedStreamChannel> createLocalStreamServer(LocalSocketAddress bindAddress, ChannelListener<? super AcceptingChannel<ConnectedStreamChannel>> acceptListener, OptionMap optionMap) throws java.io.IOException
bindAddress - the address to bind toacceptListener - the initial accept listeneroptionMap - the initial configuration for the serverjava.io.IOException - if the server could not be createdpublic IoFuture<ConnectedStreamChannel> connectStream(java.net.SocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, OptionMap optionMap)
destination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for noneoptionMap - the option mappublic IoFuture<ConnectedStreamChannel> connectStream(java.net.SocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mappublic IoFuture<ConnectedStreamChannel> connectStream(java.net.SocketAddress bindAddress, java.net.SocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the local address to bind todestination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedStreamChannel> connectTcpStream(java.net.InetSocketAddress bindAddress, java.net.InetSocketAddress destinationAddress, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the bind addressdestinationAddress - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option map @return the future result of this operationprotected IoFuture<ConnectedStreamChannel> connectLocalStream(LocalSocketAddress bindAddress, LocalSocketAddress destinationAddress, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the bind addressdestinationAddress - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mappublic IoFuture<ConnectedStreamChannel> acceptStream(java.net.SocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination (bind) addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the acceptor is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedStreamChannel> acceptLocalStream(LocalSocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination (bind) addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the acceptor is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedStreamChannel> acceptTcpStream(java.net.InetSocketAddress destination, ChannelListener<? super ConnectedStreamChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination (bind) addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the acceptor is bound, or null for noneoptionMap - the option mappublic IoFuture<ConnectedMessageChannel> connectDatagram(java.net.SocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mappublic IoFuture<ConnectedMessageChannel> connectDatagram(java.net.SocketAddress bindAddress, java.net.SocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the local address to bind todestination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedMessageChannel> connectUdpDatagram(java.net.InetSocketAddress bindAddress, java.net.InetSocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the bind addressdestination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedMessageChannel> connectLocalDatagram(LocalSocketAddress bindAddress, LocalSocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
bindAddress - the bind addressdestination - the destination addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the channel is bound, or null for noneoptionMap - the option mappublic IoFuture<ConnectedMessageChannel> acceptDatagram(java.net.SocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination (bind) addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the acceptor is bound, or null for noneoptionMap - the option mapprotected IoFuture<ConnectedMessageChannel> acceptLocalDatagram(LocalSocketAddress destination, ChannelListener<? super ConnectedMessageChannel> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap)
destination - the destination (bind) addressopenListener - the listener which will be notified when the channel is open, or null for nonebindListener - the listener which will be notified when the acceptor is bound, or null for noneoptionMap - the option mappublic MulticastMessageChannel createUdpServer(java.net.InetSocketAddress bindAddress, ChannelListener<? super MulticastMessageChannel> bindListener, OptionMap optionMap) throws java.io.IOException
bindAddress - the bind addressbindListener - the initial open-connection listeneroptionMap - the initial configuration for the serverjava.io.IOException - if the server could not be createdpublic MulticastMessageChannel createUdpServer(java.net.InetSocketAddress bindAddress, OptionMap optionMap) throws java.io.IOException
bindAddress - the bind addressoptionMap - the initial configuration for the serverjava.io.IOException - if the server could not be createdpublic void createPipe(ChannelListener<? super StreamChannel> leftOpenListener, ChannelListener<? super StreamChannel> rightOpenListener, OptionMap optionMap) throws java.io.IOException
leftOpenListener - the left-hand open listenerrightOpenListener - the right-hand open listeneroptionMap - the pipe channel configurationjava.io.IOException - if the pipe could not be createdpublic void createOneWayPipe(ChannelListener<? super StreamSourceChannel> sourceListener, ChannelListener<? super StreamSinkChannel> sinkListener, OptionMap optionMap) throws java.io.IOException
sourceListener - the source open listenersinkListener - the sink open listeneroptionMap - the pipe channel configurationjava.io.IOException - if the pipe could not be createdpublic abstract void shutdown()
shutdown in interface java.util.concurrent.ExecutorServicepublic abstract java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow in interface java.util.concurrent.ExecutorServicepublic abstract boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic abstract boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServicepublic abstract boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionprotected java.lang.Runnable getTerminationTask()
protected void taskPoolTerminated()
protected void shutDownTaskPool()
taskPoolTerminated() method is called.protected java.util.List<java.lang.Runnable> shutDownTaskPoolNow()
public void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executorcommand - the command to runpublic boolean supportsOption(Option<?> option)
ConfigurablesupportsOption in interface Configurableoption - the optiontrue if it is supportedpublic <T> T getOption(Option<T> option) throws java.io.IOException
ConfigurablegetOption in interface ConfigurableT - the type of the option valueoption - the option to getnull if it is not setjava.io.IOException - if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws java.lang.IllegalArgumentException, java.io.IOException
ConfigurablesetOption in interface ConfigurableT - the type of the option valueoption - the option to setvalue - the value of the option to setjava.lang.IllegalArgumentException - if the value is not acceptable for this optionjava.io.IOException - if an I/O error occurred when modifying the optionpublic Xnio getXnio()
public java.lang.String getName()
Copyright © 2010 JBoss, a division of Red Hat, Inc.