Top Description Fields Constructors Methods
org.xnio.channels

public Class AssembledChannel

extends Object
implements CloseableChannel
Class Inheritance
All Implemented Interfaces
org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, java.nio.channels.InterruptibleChannel, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
org.xnio.channels.AssembledConnectedChannel
Imports
java.io.IOException, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, org.xnio.ChannelListener, .ChannelListeners, .IoUtils, .Option, .XnioIoThread, .XnioWorker

A closeable view over a read and write side of a suspendable channel.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final ChannelListener.SimpleSetter<AssembledChannel>
private final ChannelListener<CloseableChannel>
private final SuspendableReadChannel
private volatile int
private static final AtomicIntegerFieldUpdater<AssembledChannel>
private final SuspendableWriteChannel

Constructor Summary

AccessConstructor and Description
public
AssembledChannel(final SuspendableReadChannel
the read side
readChannel
,
final SuspendableWriteChannel
the write side
writeChannel
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements org.xnio.channels.CloseableChannel.close.

Close this channel.

public ChannelListener.Setter<? extends CloseableChannel>
getCloseSetter()

Implements org.xnio.channels.CloseableChannel.getCloseSetter.

Get the setter which can be used to change the close listener for this channel.

public XnioIoThread
getIoThread()

Implements org.xnio.channels.CloseableChannel.getIoThread.

Get the I/O thread associated with this channel.

public <T> T
getOption(final Option<T>
the option to get
option
)

Implements org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

public XnioWorker
getWorker()

Implements org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

public boolean
isOpen()

Implements java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

private static <T> T
nonNullOrFirst(T one, T two)

public <T> T
setOption(final Option<T>
the option to set
option
,
final T
the value of the option to set
value
)

Implements org.xnio.channels.Configurable.setOption.

Set an option for this channel.

public boolean
supportsOption(final Option<?>
the option
option
)

Implements org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closeSetterback to summary
private final ChannelListener.SimpleSetter<AssembledChannel> closeSetter
listenerback to summary
private final ChannelListener<CloseableChannel> listener
readChannelback to summary
private final SuspendableReadChannel readChannel
stateback to summary
private volatile int state
Annotations
@SuppressWarnings:unused
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<AssembledChannel> stateUpdater
writeChannelback to summary
private final SuspendableWriteChannel writeChannel

Constructor Detail

AssembledChannelback to summary
public AssembledChannel(final SuspendableReadChannel readChannel, final SuspendableWriteChannel writeChannel)

Construct a new instance.

Parameters
readChannel:SuspendableReadChannel

the read side

writeChannel:SuspendableWriteChannel

the write side

Method Detail

closeback to summary
public void close() throws IOException

Implements org.xnio.channels.CloseableChannel.close.

Doc from org.xnio.channels.CloseableChannel.close.

Close this channel. When a channel is closed, its close listener is invoked. Invoking this method more than once has no additional effect.

Exceptions
IOException:
if the close failed
getCloseSetterback to summary
public ChannelListener.Setter<? extends CloseableChannel> getCloseSetter()

Implements org.xnio.channels.CloseableChannel.getCloseSetter.

Doc from org.xnio.channels.CloseableChannel.getCloseSetter.

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.

Returns:ChannelListener.Setter<? extends CloseableChannel>

the setter

getIoThreadback to summary
public XnioIoThread getIoThread()

Implements org.xnio.channels.CloseableChannel.getIoThread.

Doc from org.xnio.channels.CloseableChannel.getIoThread.

Get the I/O thread associated with this channel.

Returns:XnioIoThread

the I/O thread associated with this channel

getOptionback to summary
public <T> T getOption(final Option<T> option) throws IOException

Implements org.xnio.channels.Configurable.getOption.

Doc from org.xnio.channels.Configurable.getOption.

Get the value of a channel option.

Parameters
<T>
the type of the option value
option:Option<T>

the option to get

Returns:T

the value of the option, or null if it is not set

Exceptions
IOException:
if an I/O error occurred when reading the option
getWorkerback to summary
public XnioWorker getWorker()

Implements org.xnio.channels.CloseableChannel.getWorker.

Doc from org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

Returns:XnioWorker

the worker

isOpenback to summary
public boolean isOpen()

Implements java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Returns:boolean

true if, and only if, this channel is open

nonNullOrFirstback to summary
private static <T> T nonNullOrFirst(T one, T two)
setOptionback to summary
public <T> T setOption(final Option<T> option, final T value) throws IllegalArgumentException, IOException

Implements org.xnio.channels.Configurable.setOption.

Doc from org.xnio.channels.Configurable.setOption.

Set an option for this channel. Unsupported options are ignored.

Parameters
<T>
the type of the option value
option:Option<T>

the option to set

value:T

the value of the option to set

Returns:T

the previous option value, if any

Exceptions
IllegalArgumentException:
if the value is not acceptable for this option
IOException:
if an I/O error occurred when modifying the option
supportsOptionback to summary
public boolean supportsOption(final Option<?> option)

Implements org.xnio.channels.Configurable.supportsOption.

Doc from org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

Parameters
option:Option<?>

the option

Returns:boolean

true if it is supported