- All Known Implementing Classes:
XnioIoThread
,XnioWorker
public interface XnioIoFactory
An XNIO I/O factory which can be used to create channels.
- Author:
- David M. Lloyd
-
Method Summary
Modifier and TypeMethodDescriptionacceptMessageConnection
(SocketAddress destination, ChannelListener<? super MessageConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Accept a message connection at a destination address.acceptStreamConnection
(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Accept a stream connection at a destination address.Create a two-way stream pipe.Create a two-way stream pipe.Create a two-way stream pipe.Create a one-way stream pipe.Create a one-way stream pipe.openMessageConnection
(SocketAddress destination, ChannelListener<? super MessageConnection> openListener, OptionMap optionMap) Connect to a remote message server.openStreamConnection
(SocketAddress bindAddress, SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Connect to a remote stream server.openStreamConnection
(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Connect to a remote stream server.openStreamConnection
(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, OptionMap optionMap) Connect to a remote stream server.
-
Method Details
-
openStreamConnection
IoFuture<StreamConnection> openStreamConnection(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, OptionMap optionMap) Connect to a remote stream server. The protocol family is determined by the type of the socket address given. If an open listener is used, the channel should not be accessed via the returnedIoFuture
, and vice-versa.- Parameters:
destination
- the destination addressopenListener
- the listener which will be notified when the channel is open, ornull
for noneoptionMap
- the option map- Returns:
- the future result of this operation
-
openStreamConnection
IoFuture<StreamConnection> openStreamConnection(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Connect to a remote stream server. The protocol family is determined by the type of the socket address given. If an open listener is used, the channel should not be accessed via the returnedIoFuture
, and vice-versa.- Parameters:
destination
- the destination addressopenListener
- the listener which will be notified when the channel is open, ornull
for nonebindListener
- the listener which will be notified when the channel is bound, ornull
for noneoptionMap
- the option map- Returns:
- the future result of this operation
-
openStreamConnection
IoFuture<StreamConnection> openStreamConnection(SocketAddress bindAddress, SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Connect to a remote stream server. The protocol family is determined by the type of the socket addresses given (which must match). If an open listener is used, the channel should not be accessed via the returnedIoFuture
, and vice-versa.- Parameters:
bindAddress
- the local address to bind todestination
- the destination addressopenListener
- the listener which will be notified when the channel is open, ornull
for nonebindListener
- the listener which will be notified when the channel is bound, ornull
for noneoptionMap
- the option map- Returns:
- the future result of this operation
-
acceptStreamConnection
IoFuture<StreamConnection> acceptStreamConnection(SocketAddress destination, ChannelListener<? super StreamConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Accept a stream connection at a destination address. If a wildcard address is specified, then a destination address is chosen in a manner specific to the OS and/or channel type.- Parameters:
destination
- the destination (bind) addressopenListener
- the listener which will be notified when the channel is open, ornull
for nonebindListener
- the listener which will be notified when the acceptor is bound, ornull
for noneoptionMap
- the option map- Returns:
- the future connection
-
openMessageConnection
IoFuture<MessageConnection> openMessageConnection(SocketAddress destination, ChannelListener<? super MessageConnection> openListener, OptionMap optionMap) Connect to a remote message server. The protocol family is determined by the type of the socket address given. If an open listener is used, the channel should not be accessed via the returnedIoFuture
, and vice-versa.- Parameters:
destination
- the destination addressopenListener
- the listener which will be notified when the channel is open, ornull
for noneoptionMap
- the option map- Returns:
- the future result of this operation
-
acceptMessageConnection
IoFuture<MessageConnection> acceptMessageConnection(SocketAddress destination, ChannelListener<? super MessageConnection> openListener, ChannelListener<? super BoundChannel> bindListener, OptionMap optionMap) Accept a message connection at a destination address. If a wildcard address is specified, then a destination address is chosen in a manner specific to the OS and/or channel type. If an open listener is used, the channel should not be accessed via the returnedIoFuture
, and vice-versa.- Parameters:
destination
- the destination (bind) addressopenListener
- the listener which will be notified when the channel is open, ornull
for nonebindListener
- the listener which will be notified when the acceptor is bound, ornull
for noneoptionMap
- the option map- Returns:
- the future connection
-
createFullDuplexPipe
Create a two-way stream pipe.- Returns:
- the created pipe
- Throws:
IOException
- if the pipe could not be created
-
createFullDuplexPipeConnection
Create a two-way stream pipe.- Returns:
- the created pipe
- Throws:
IOException
- if the pipe could not be created
-
createHalfDuplexPipe
Create a one-way stream pipe.- Returns:
- the created pipe
- Throws:
IOException
- if the pipe could not be created
-
createFullDuplexPipeConnection
ChannelPipe<StreamConnection,StreamConnection> createFullDuplexPipeConnection(XnioIoFactory peer) throws IOException Create a two-way stream pipe. The left side will be associated with this factory, and the right side will be associated with the given peer.- Parameters:
peer
- the peer to use for controlling the remote (right) side- Returns:
- the created pipe
- Throws:
IOException
- if the pipe could not be created
-
createHalfDuplexPipe
ChannelPipe<StreamSourceChannel,StreamSinkChannel> createHalfDuplexPipe(XnioIoFactory peer) throws IOException Create a one-way stream pipe. The left (source) side will be associated with this factory, and the right (sink) side will be associated with the given peer.- Parameters:
peer
- the peer to use for the sink (right) side- Returns:
- the created pipe
- Throws:
IOException
- if the pipe could not be created
-