- java.lang.Object
-
- org.xnio.channels.AssembledMessageChannel
-
- org.xnio.channels.AssembledConnectedMessageChannel
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,java.nio.channels.InterruptibleChannel
,BoundChannel
,CloseableChannel
,Configurable
,ConnectedChannel
,ConnectedMessageChannel
,MessageChannel
,ReadableMessageChannel
,SuspendableChannel
,SuspendableReadChannel
,SuspendableWriteChannel
,WritableMessageChannel
public class AssembledConnectedMessageChannel extends AssembledMessageChannel implements ConnectedMessageChannel
A connected bidirectional message channel assembled from a readable and writable message channel.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
-
Constructor Summary
Constructors Constructor Description AssembledConnectedMessageChannel(ConnectedChannel connection, ReadableMessageChannel readable, WritableMessageChannel writable)
Construct a new instance.AssembledConnectedMessageChannel(ReadableMessageChannel readable, WritableMessageChannel writable)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChannelListener.Setter<? extends AssembledConnectedMessageChannel>
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.java.net.SocketAddress
getLocalAddress()
Get the local address that this channel is bound to.<A extends java.net.SocketAddress>
AgetLocalAddress(java.lang.Class<A> type)
Get the local address of a given type, ornull
if the address is not of that type.java.net.SocketAddress
getPeerAddress()
Get the peer address of this channel.<A extends java.net.SocketAddress>
AgetPeerAddress(java.lang.Class<A> type)
Get the peer address of a given type, ornull
if the address is not of that type.ChannelListener.Setter<? extends AssembledConnectedMessageChannel>
getReadSetter()
Get the setter which can be used to change the read listener for this channel.ChannelListener.Setter<? extends AssembledConnectedMessageChannel>
getWriteSetter()
Get the setter which can be used to change the write listener for this channel.-
Methods inherited from class org.xnio.channels.AssembledMessageChannel
awaitReadable, awaitReadable, awaitWritable, awaitWritable, close, flush, getIoThread, getOption, getReadThread, getWorker, getWriteThread, isOpen, isReadResumed, isWriteResumed, receive, receive, receive, resumeReads, resumeWrites, send, send, send, sendFinal, sendFinal, sendFinal, setOption, shutdownReads, shutdownWrites, supportsOption, suspendReads, suspendWrites, wakeupReads, wakeupWrites
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.xnio.channels.CloseableChannel
getIoThread, getWorker
-
Methods inherited from interface org.xnio.channels.Configurable
getOption, setOption, supportsOption
-
Methods inherited from interface org.xnio.channels.ReadableMessageChannel
receive, receive, receive
-
Methods inherited from interface org.xnio.channels.SuspendableReadChannel
awaitReadable, awaitReadable, getReadThread, isReadResumed, resumeReads, shutdownReads, suspendReads, wakeupReads
-
Methods inherited from interface org.xnio.channels.SuspendableWriteChannel
awaitWritable, awaitWritable, close, flush, getWriteThread, isOpen, isWriteResumed, resumeWrites, shutdownWrites, suspendWrites, wakeupWrites
-
-
-
-
Constructor Detail
-
AssembledConnectedMessageChannel
public AssembledConnectedMessageChannel(ConnectedChannel connection, ReadableMessageChannel readable, WritableMessageChannel writable)
Construct a new instance.- Parameters:
connection
- the connected channelreadable
- the read channelwritable
- the write channel
-
AssembledConnectedMessageChannel
public AssembledConnectedMessageChannel(ReadableMessageChannel readable, WritableMessageChannel writable)
Construct a new instance. At least one side must be connected.- Parameters:
readable
- the read channelwritable
- the write channel
-
-
Method Detail
-
getCloseSetter
public ChannelListener.Setter<? extends AssembledConnectedMessageChannel> getCloseSetter()
Description copied from interface:MessageChannel
Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.- Specified by:
getCloseSetter
in interfaceBoundChannel
- Specified by:
getCloseSetter
in interfaceCloseableChannel
- Specified by:
getCloseSetter
in interfaceConnectedChannel
- Specified by:
getCloseSetter
in interfaceConnectedMessageChannel
- Specified by:
getCloseSetter
in interfaceMessageChannel
- Specified by:
getCloseSetter
in interfaceReadableMessageChannel
- Specified by:
getCloseSetter
in interfaceSuspendableChannel
- Specified by:
getCloseSetter
in interfaceSuspendableReadChannel
- Specified by:
getCloseSetter
in interfaceSuspendableWriteChannel
- Specified by:
getCloseSetter
in interfaceWritableMessageChannel
- Overrides:
getCloseSetter
in classAssembledMessageChannel
- Returns:
- the setter
-
getReadSetter
public ChannelListener.Setter<? extends AssembledConnectedMessageChannel> getReadSetter()
Description copied from interface:MessageChannel
Get the setter which can be used to change the read listener for this channel.- Specified by:
getReadSetter
in interfaceConnectedMessageChannel
- Specified by:
getReadSetter
in interfaceMessageChannel
- Specified by:
getReadSetter
in interfaceReadableMessageChannel
- Specified by:
getReadSetter
in interfaceSuspendableChannel
- Specified by:
getReadSetter
in interfaceSuspendableReadChannel
- Overrides:
getReadSetter
in classAssembledMessageChannel
- Returns:
- the setter
-
getWriteSetter
public ChannelListener.Setter<? extends AssembledConnectedMessageChannel> getWriteSetter()
Description copied from interface:MessageChannel
Get the setter which can be used to change the write listener for this channel.- Specified by:
getWriteSetter
in interfaceConnectedMessageChannel
- Specified by:
getWriteSetter
in interfaceMessageChannel
- Specified by:
getWriteSetter
in interfaceSuspendableChannel
- Specified by:
getWriteSetter
in interfaceSuspendableWriteChannel
- Specified by:
getWriteSetter
in interfaceWritableMessageChannel
- Overrides:
getWriteSetter
in classAssembledMessageChannel
- Returns:
- the setter
-
getPeerAddress
public java.net.SocketAddress getPeerAddress()
Description copied from interface:ConnectedChannel
Get the peer address of this channel.- Specified by:
getPeerAddress
in interfaceConnectedChannel
- Returns:
- the peer address
-
getPeerAddress
public <A extends java.net.SocketAddress> A getPeerAddress(java.lang.Class<A> type)
Description copied from interface:ConnectedChannel
Get the peer address of a given type, ornull
if the address is not of that type.- Specified by:
getPeerAddress
in interfaceConnectedChannel
- Parameters:
type
- the address type class- Returns:
- the peer address, or
null
if unknown
-
getLocalAddress
public java.net.SocketAddress getLocalAddress()
Description copied from interface:BoundChannel
Get the local address that this channel is bound to.- Specified by:
getLocalAddress
in interfaceBoundChannel
- Returns:
- the local address
-
getLocalAddress
public <A extends java.net.SocketAddress> A getLocalAddress(java.lang.Class<A> type)
Description copied from interface:BoundChannel
Get the local address of a given type, ornull
if the address is not of that type.- Specified by:
getLocalAddress
in interfaceBoundChannel
- Type Parameters:
A
- the address type- Parameters:
type
- the address type class- Returns:
- the local address, or
null
if unknown
-
-