Top Description Fields Constructors Methods
org.xnio.channels

public abstract Class TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>

extends Object
implements SuspendableChannel, WrappedChannel<W extends SuspendableChannel>, ReadListenerSettable<C extends SuspendableChannel>, WriteListenerSettable<C extends SuspendableChannel>, CloseListenerSettable<C extends SuspendableChannel>
Class Inheritance
All Implemented Interfaces
org.xnio.channels.CloseListenerSettable, org.xnio.channels.WriteListenerSettable, org.xnio.channels.ReadListenerSettable, org.xnio.channels.WrappedChannel, org.xnio.channels.SuspendableChannel, org.xnio.channels.SuspendableWriteChannel, org.xnio.channels.CloseableChannel, org.xnio.channels.Configurable, java.nio.channels.InterruptibleChannel, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable, org.xnio.channels.SuspendableReadChannel
Known Direct Subclasses
org.xnio.channels.FramedMessageChannel
Annotations
@Deprecated
Type Parameters
<C>
the channel type implemented by this class
<W>
the channel type being wrapped by this class
Static Imports
java.lang.Thread.currentThread, java.util.concurrent.locks.LockSupport.park, .LockSupport.parkNanos, .LockSupport.unpark, org.xnio.Bits.allAreClear, .Bits.allAreSet, .Bits.anyAreSet, .Bits.intBitMask, org.xnio._private.Messages.msg

Deprecated

This class is deprecated; use conduits instead.

An abstract wrapped channel.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
protected final W
channel

The wrapped channel.

private ChannelListener<? super C>
private final ChannelListener<Channel>
private final ChannelListener<Channel>
private final ChannelListener<Channel>
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private ChannelListener<? super C>
private volatile Thread
private static final AtomicReferenceFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>, Thread>
private volatile int
private static final AtomicIntegerFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>>
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private ChannelListener<? super C>
private volatile Thread
private static final AtomicReferenceFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>, Thread>

Constructor Summary

AccessConstructor and Description
protected
TranslatingSuspendableChannel(final W
the channel being wrapped
channel
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
private int
addFlag(final int mask, final int count)

public void
awaitReadable()

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

Block until this channel becomes readable again.

public void
awaitReadable(final long
the time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

Block until this channel becomes readable again, or until the timeout expires.

public void
awaitWritable()

Implements org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Block until this channel becomes writable again.

public void
awaitWritable(final long
the time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Implements org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Block until this channel becomes writable again, or until the timeout expires.

private int
clearFlag(final int count)

private int
clearFlags(int flags)

protected void
clearReadReady()

Indicate that the channel is no longer definitely immediately readable.

protected void
clearReadRequiresWrite()

Indicate that the channel no longer requires writability for reads to proceed.

protected void
clearWriteReady()

Indicate that the channel is no longer definitely immediately writable.

protected void
clearWriteRequiresRead()

Indicate that the channel no longer requires writability for writes to proceed.

public void
protected void
closeAction(final boolean
if reads were previously shut down
readShutDown
,
final boolean
if writes were previously shut down
writeShutDown
)

The action to perform when the channel is closed via the close() method.

public final boolean

Returns:

true if the flush completed, or false if the operation would block
flush
()

Implements org.xnio.channels.SuspendableWriteChannel.flush.

Perform channel flush.

protected boolean

Returns:

true if the flush succeeded, false if it would block
flushAction
(final boolean
true if the channel's write side has been shut down, false otherwise
shutDown
)

The action to perform when the channel is flushed.

public W
getChannel()

Implements org.xnio.channels.WrappedChannel.getChannel.

Get the channel which is wrapped by this object.

public ChannelListener<? super C>
public ChannelListener.Setter<C>
getCloseSetter()

Implements org.xnio.channels.SuspendableChannel.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 ChannelListener<? super C>
public ChannelListener.Setter<C>
getReadSetter()

Implements org.xnio.channels.SuspendableChannel.getReadSetter.

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

public XnioExecutor
getReadThread()

Implements org.xnio.channels.SuspendableReadChannel.getReadThread.

Deprecated

Get the read thread for this channel.

public XnioWorker
getWorker()

Implements org.xnio.channels.CloseableChannel.getWorker.

Get the worker for this channel.

public ChannelListener<? super C>
public ChannelListener.Setter<C>
getWriteSetter()

Implements org.xnio.channels.SuspendableChannel.getWriteSetter.

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

public XnioExecutor
getWriteThread()

Implements org.xnio.channels.SuspendableWriteChannel.getWriteThread.

Deprecated

Get the write thread for this channel.

protected void
handleClosed()

Called when the underlying channel is closed.

protected void
handleReadable()

Called when the underlying channel is readable.

protected void
handleWritable()

Called when the underlying channel is writable.

public boolean
public boolean
isReadResumed()

Implements org.xnio.channels.SuspendableReadChannel.isReadResumed.

Determine whether reads are resumed.

protected boolean

Returns:

whether the channel is shut down for reads
isReadShutDown
()

Determine whether the channel is shut down for reads.

protected boolean
public boolean
isWriteResumed()

Implements org.xnio.channels.SuspendableWriteChannel.isWriteResumed.

Determine whether writes are resumed.

protected boolean

Returns:

whether the channel is shut down for writes
isWriteShutDown
()

Determine whether the channel is shut down for writes.

protected boolean
readRequiresWrite()

Indicate if the channel is not readable until the write handler is called.

protected void
removeReadRequiresExternal()

Indicate that one external read task was completed.

protected void
removeWriteRequiresExternal()

Indicate that one external write task was completed.

public void
resumeReads()

Implements org.xnio.channels.SuspendableReadChannel.resumeReads.

Resume reads on this channel.

public void
resumeWrites()

Implements org.xnio.channels.SuspendableWriteChannel.resumeWrites.

Resume writes on this channel.

protected boolean

Returns:

true if the channel has fully closed (for the first time) due to this call, false otherwise
setClosed
()

Set both the channel read and write shut down flags.

public void
setCloseListener(final ChannelListener<? super C>
the close listener
closeListener
)

Implements org.xnio.channels.CloseListenerSettable.setCloseListener.

Set the close listener.

private int
setFlags(int flags)

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 void
setReadListener(final ChannelListener<? super C>
the read listener
readListener
)

Implements org.xnio.channels.ReadListenerSettable.setReadListener.

Set the read listener.

protected void
setReadReady()

Indicate that the channel is definitely immediately readable, regardless of the underlying channel state.

protected void
setReadRequiresWrite()

Indicate that the channel will not be readable until the write handler is called.

protected boolean

Returns:

true if the channel has fully closed due to this call, false otherwise
setReadShutDown
()

Set the channel read shut down flag.

public void
setWriteListener(final ChannelListener<? super C>
the write listener
writeListener
)

Implements org.xnio.channels.WriteListenerSettable.setWriteListener.

Set the write listener.

protected void
setWriteReady()

Indicate that the channel is definitely immediately writable, regardless of the underlying channel state.

protected void
setWriteRequiresRead()

Indicate that the channel will not be writable until the read handler is called.

protected boolean

Returns:

true if the channel has fully closed due to this call, false otherwise
setWriteShutDown
()

Set the channel write shut down flag.

public void
shutdownReads()

Implements org.xnio.channels.SuspendableReadChannel.shutdownReads.

Perform the read shutdown action if it hasn't been performed already.

protected void
shutdownReadsAction(final boolean writeComplete)

The action to perform when reads are shut down.

public void
shutdownWrites()

Implements org.xnio.channels.SuspendableWriteChannel.shutdownWrites.

Perform the write shutdown action if it hasn't been performed already.

protected void
shutdownWritesAction()

The action to perform when writes are requested to be shut down.

protected void
shutdownWritesComplete(final boolean
true if the read side was already shut down, false otherwise
readShutDown
)

Notification that the channel has successfully flushed after having shut down writes.

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

Implements org.xnio.channels.Configurable.supportsOption.

Determine whether an option is supported on this channel.

public void
suspendReads()

Implements org.xnio.channels.SuspendableReadChannel.suspendReads.

Suspend further read notifications on this channel.

public void
suspendWrites()

Implements org.xnio.channels.SuspendableWriteChannel.suspendWrites.

Suspend further write notifications on this channel.

protected final C

Returns:

this
thisTyped
()

Get this channel, cast to the implemented channel type.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

protected boolean

Returns:

true if the flag was set, false if too many tasks are already outstanding
tryAddReadRequiresExternal
()

Indicate that read requires an external task to complete.

protected boolean

Returns:

true if the flag was set, false if too many tasks are already outstanding
tryAddWriteRequiresExternal
()

Indicate that write requires an external task to complete.

private void
private void
public void
wakeupReads()

Implements org.xnio.channels.SuspendableReadChannel.wakeupReads.

Resume reads on this channel, and force the read listener to be triggered even if the channel isn't actually readable.

public void
wakeupWrites()

Implements org.xnio.channels.SuspendableWriteChannel.wakeupWrites.

Resume writes on this channel, and force the write listener to be triggered even if the channel isn't actually writable.

protected boolean
writeRequiresRead()

Indicate if the channel is not writable until the read handler is called.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

channelback to summary
protected final W channel

The wrapped channel.

closeListenerback to summary
private ChannelListener<? super C> closeListener
delegateCloseListenerback to summary
private final ChannelListener<Channel> delegateCloseListener
delegateReadListenerback to summary
private final ChannelListener<Channel> delegateReadListener
delegateWriteListenerback to summary
private final ChannelListener<Channel> delegateWriteListener
READ_FLAGSback to summary
private static final int READ_FLAGS
Annotations
@SuppressWarnings:unused
READ_READYback to summary
private static final int READ_READY
READ_REQUESTEDback to summary
private static final int READ_REQUESTED
READ_REQUIRES_EXTback to summary
private static final int READ_REQUIRES_EXT
READ_REQUIRES_WRITEback to summary
private static final int READ_REQUIRES_WRITE
READ_SHUT_DOWNback to summary
private static final int READ_SHUT_DOWN
READ_SINGLE_EXTback to summary
private static final int READ_SINGLE_EXT
readListenerback to summary
private ChannelListener<? super C> readListener
readWaiterback to summary
private volatile Thread readWaiter
Annotations
@SuppressWarnings:unused
readWaiterUpdaterback to summary
private static final AtomicReferenceFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>, Thread> readWaiterUpdater
Annotations
@SuppressWarnings:rawtypes
stateback to summary
private volatile int state
Annotations
@SuppressWarnings:unused
stateUpdaterback to summary
private static final AtomicIntegerFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>> stateUpdater
Annotations
@SuppressWarnings:rawtypes
WRITE_COMPLETEback to summary
private static final int WRITE_COMPLETE
WRITE_FLAGSback to summary
private static final int WRITE_FLAGS
Annotations
@SuppressWarnings:unused
WRITE_READYback to summary
private static final int WRITE_READY
WRITE_REQUESTEDback to summary
private static final int WRITE_REQUESTED
WRITE_REQUIRES_EXTback to summary
private static final int WRITE_REQUIRES_EXT
WRITE_REQUIRES_READback to summary
private static final int WRITE_REQUIRES_READ
WRITE_SHUT_DOWNback to summary
private static final int WRITE_SHUT_DOWN
WRITE_SINGLE_EXTback to summary
private static final int WRITE_SINGLE_EXT
writeListenerback to summary
private ChannelListener<? super C> writeListener
writeWaiterback to summary
private volatile Thread writeWaiter
Annotations
@SuppressWarnings:unused
writeWaiterUpdaterback to summary
private static final AtomicReferenceFieldUpdater<TranslatingSuspendableChannel<C extends SuspendableChannel, W extends SuspendableChannel>, Thread> writeWaiterUpdater
Annotations
@SuppressWarnings:rawtypes

Constructor Detail

TranslatingSuspendableChannelback to summary
protected TranslatingSuspendableChannel(final W channel)

Construct a new instance.

Parameters
channel:W

the channel being wrapped

Method Detail

addFlagback to summary
private int addFlag(final int mask, final int count)
awaitReadableback to summary
public void awaitReadable() throws IOException

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

Doc from org.xnio.channels.SuspendableReadChannel.awaitReadable.

Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.

Exceptions
IOException:
if an I/O error occurs
awaitReadableback to summary
public void awaitReadable(final long time, final TimeUnit timeUnit) throws IOException

Implements org.xnio.channels.SuspendableReadChannel.awaitReadable.

Doc from org.xnio.channels.SuspendableReadChannel.awaitReadable.

Block until this channel becomes readable again, or until the timeout expires. This method may return spuriously before the channel becomes readable or the timeout expires.

Parameters
time:long

the time to wait

timeUnit:TimeUnit

the time unit

Exceptions
IOException:
if an I/O error occurs
awaitWritableback to summary
public void awaitWritable() throws IOException

Implements org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Doc from org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.

Exceptions
IOException:
if an I/O error occurs
awaitWritableback to summary
public void awaitWritable(final long time, final TimeUnit timeUnit) throws IOException

Implements org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Doc from org.xnio.channels.SuspendableWriteChannel.awaitWritable.

Block until this channel becomes writable again, or until the timeout expires. This method may return spuriously before the channel becomes writable or the timeout expires.

Parameters
time:long

the time to wait

timeUnit:TimeUnit

the time unit

Exceptions
IOException:
if an I/O error occurs
clearFlagback to summary
private int clearFlag(final int count)
clearFlagsback to summary
private int clearFlags(int flags)
clearReadReadyback to summary
protected void clearReadReady()

Indicate that the channel is no longer definitely immediately readable.

clearReadRequiresWriteback to summary
protected void clearReadRequiresWrite()

Indicate that the channel no longer requires writability for reads to proceed.

clearWriteReadyback to summary
protected void clearWriteReady()

Indicate that the channel is no longer definitely immediately writable.

clearWriteRequiresReadback to summary
protected void clearWriteRequiresRead()

Indicate that the channel no longer requires writability for writes to proceed.

closeback to summary
public void close() throws IOException

Implements org.xnio.channels.CloseableChannel.close, org.xnio.channels.SuspendableWriteChannel.close.

Close this channel. This method is idempotent.

Exceptions
IOException:
if an I/O error occurs
closeActionback to summary
protected void closeAction(final boolean readShutDown, final boolean writeShutDown) throws IOException

The action to perform when the channel is closed via the close() method. By default, the underlying channel is closed.

Parameters
readShutDown:boolean

if reads were previously shut down

writeShutDown:boolean

if writes were previously shut down

Exceptions
IOException:
if an error occurs
flushback to summary
public final boolean flush() throws IOException

Implements org.xnio.channels.SuspendableWriteChannel.flush.

Perform channel flush. To change the action taken to flush, subclasses should override flushAction(boolean).

Returns:boolean

true if the flush completed, or false if the operation would block

Exceptions
IOException:
if an error occurs
flushActionback to summary
protected boolean flushAction(final boolean shutDown) throws IOException

The action to perform when the channel is flushed. By default, this method delegates to the underlying channel. If the shutDown parameter is set, and this method returns true, the underlying channel will be shut down and this method will never be called again (future calls to flush() will flush the underlying channel until it returns true).

Parameters
shutDown:boolean

true if the channel's write side has been shut down, false otherwise

Returns:boolean

true if the flush succeeded, false if it would block

Exceptions
IOException:
if an error occurs
getChannelback to summary
public W getChannel()

Implements org.xnio.channels.WrappedChannel.getChannel.

Doc from org.xnio.channels.WrappedChannel.getChannel.

Get the channel which is wrapped by this object.

Returns:W

the wrapped channel

getCloseListenerback to summary
public ChannelListener<? super C> getCloseListener()

Implements org.xnio.channels.CloseListenerSettable.getCloseListener.

Doc from org.xnio.channels.CloseListenerSettable.getCloseListener.

Get the close listener.

Returns:ChannelListener<? super C>

the close listener

getCloseSetterback to summary
public ChannelListener.Setter<C> getCloseSetter()

Implements org.xnio.channels.SuspendableChannel.getCloseSetter.

Doc from org.xnio.channels.SuspendableChannel.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<C>

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

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
getReadListenerback to summary
public ChannelListener<? super C> getReadListener()

Implements org.xnio.channels.ReadListenerSettable.getReadListener.

Doc from org.xnio.channels.ReadListenerSettable.getReadListener.

Get the read listener.

Returns:ChannelListener<? super C>

the read listener

getReadSetterback to summary
public ChannelListener.Setter<C> getReadSetter()

Implements org.xnio.channels.SuspendableChannel.getReadSetter.

Doc from org.xnio.channels.SuspendableChannel.getReadSetter.

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

Returns:ChannelListener.Setter<C>

Doc from org.xnio.channels.SuspendableReadChannel.getReadSetter.

the setter

getReadThreadback to summary
public XnioExecutor getReadThread()

Implements org.xnio.channels.SuspendableReadChannel.getReadThread.

Doc from org.xnio.channels.SuspendableReadChannel.getReadThread.

Deprecated

Get the read thread for this channel.

Returns:XnioExecutor

the thread, or null if none is configured or available

Annotations
@Deprecated
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

getWriteListenerback to summary
public ChannelListener<? super C> getWriteListener()

Implements org.xnio.channels.WriteListenerSettable.getWriteListener.

Doc from org.xnio.channels.WriteListenerSettable.getWriteListener.

Get the write listener.

Returns:ChannelListener<? super C>

the write listener

getWriteSetterback to summary
public ChannelListener.Setter<C> getWriteSetter()

Implements org.xnio.channels.SuspendableChannel.getWriteSetter.

Doc from org.xnio.channels.SuspendableChannel.getWriteSetter.

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

Returns:ChannelListener.Setter<C>

Doc from org.xnio.channels.SuspendableWriteChannel.getWriteSetter.

the setter

getWriteThreadback to summary
public XnioExecutor getWriteThread()

Implements org.xnio.channels.SuspendableWriteChannel.getWriteThread.

Doc from org.xnio.channels.SuspendableWriteChannel.getWriteThread.

Deprecated

Get the write thread for this channel.

Returns:XnioExecutor

the thread, or null if none is configured or available

Annotations
@Deprecated
handleClosedback to summary
protected void handleClosed()

Called when the underlying channel is closed.

handleReadableback to summary
protected void handleReadable()

Called when the underlying channel is readable.

handleWritableback to summary
protected void handleWritable()

Called when the underlying channel is writable.

isOpenback to summary
public boolean isOpen()

Implements java.nio.channels.Channel.isOpen, org.xnio.channels.SuspendableWriteChannel.isOpen.

Doc from org.xnio.channels.SuspendableWriteChannel.isOpen.

Determine whether this channel is open. This method will return false if all directions are shut down, even if there is unflushed write data pending.

Returns:boolean

true if the channel is open, false otherwise

isReadResumedback to summary
public boolean isReadResumed()

Implements org.xnio.channels.SuspendableReadChannel.isReadResumed.

Doc from org.xnio.channels.SuspendableReadChannel.isReadResumed.

Determine whether reads are resumed.

Returns:boolean

true if reads are resumed, false if reads are suspended

isReadShutDownback to summary
protected boolean isReadShutDown()

Determine whether the channel is shut down for reads.

Returns:boolean

whether the channel is shut down for reads

isWriteCompleteback to summary
protected boolean isWriteComplete()
isWriteResumedback to summary
public boolean isWriteResumed()

Implements org.xnio.channels.SuspendableWriteChannel.isWriteResumed.

Doc from org.xnio.channels.SuspendableWriteChannel.isWriteResumed.

Determine whether writes are resumed.

Returns:boolean

true if writes are resumed, false if writes are suspended

isWriteShutDownback to summary
protected boolean isWriteShutDown()

Determine whether the channel is shut down for writes.

Returns:boolean

whether the channel is shut down for writes

readRequiresWriteback to summary
protected boolean readRequiresWrite()

Indicate if the channel is not readable until the write handler is called.

removeReadRequiresExternalback to summary
protected void removeReadRequiresExternal()

Indicate that one external read task was completed. This method should be called once for every time that tryAddReadRequiresExternal() returned true.

removeWriteRequiresExternalback to summary
protected void removeWriteRequiresExternal()

Indicate that one external write task was completed. This method should be called once for every time that tryAddWriteRequiresExternal() returned true.

resumeReadsback to summary
public void resumeReads()

Implements org.xnio.channels.SuspendableReadChannel.resumeReads.

Doc from org.xnio.channels.SuspendableReadChannel.resumeReads.

Resume reads on this channel. The read listener will be called as soon as there is data available to be read.

resumeWritesback to summary
public void resumeWrites()

Implements org.xnio.channels.SuspendableWriteChannel.resumeWrites.

Doc from org.xnio.channels.SuspendableWriteChannel.resumeWrites.

Resume writes on this channel. The write listener will be called as soon as the channel becomes writable.

setClosedback to summary
protected boolean setClosed()

Set both the channel read and write shut down flags.

Returns:boolean

true if the channel has fully closed (for the first time) due to this call, false otherwise

setCloseListenerback to summary
public void setCloseListener(final ChannelListener<? super C> closeListener)

Implements org.xnio.channels.CloseListenerSettable.setCloseListener.

Doc from org.xnio.channels.CloseListenerSettable.setCloseListener.

Set the close listener.

Parameters
closeListener:ChannelListener<? super C>

the close listener

setFlagsback to summary
private int setFlags(int flags)
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
setReadListenerback to summary
public void setReadListener(final ChannelListener<? super C> readListener)

Implements org.xnio.channels.ReadListenerSettable.setReadListener.

Doc from org.xnio.channels.ReadListenerSettable.setReadListener.

Set the read listener.

Parameters
readListener:ChannelListener<? super C>

the read listener

setReadReadyback to summary
protected void setReadReady()

Indicate that the channel is definitely immediately readable, regardless of the underlying channel state.

setReadRequiresWriteback to summary
protected void setReadRequiresWrite()

Indicate that the channel will not be readable until the write handler is called.

setReadShutDownback to summary
protected boolean setReadShutDown()

Set the channel read shut down flag.

Returns:boolean

true if the channel has fully closed due to this call, false otherwise

setWriteListenerback to summary
public void setWriteListener(final ChannelListener<? super C> writeListener)

Implements org.xnio.channels.WriteListenerSettable.setWriteListener.

Doc from org.xnio.channels.WriteListenerSettable.setWriteListener.

Set the write listener.

Parameters
writeListener:ChannelListener<? super C>

the write listener

setWriteReadyback to summary
protected void setWriteReady()

Indicate that the channel is definitely immediately writable, regardless of the underlying channel state.

setWriteRequiresReadback to summary
protected void setWriteRequiresRead()

Indicate that the channel will not be writable until the read handler is called.

setWriteShutDownback to summary
protected boolean setWriteShutDown()

Set the channel write shut down flag.

Returns:boolean

true if the channel has fully closed due to this call, false otherwise

shutdownReadsback to summary
public void shutdownReads() throws IOException

Implements org.xnio.channels.SuspendableReadChannel.shutdownReads.

Perform the read shutdown action if it hasn't been performed already.

Exceptions
IOException:
if an I/O error occurs
shutdownReadsActionback to summary
protected void shutdownReadsAction(final boolean writeComplete) throws IOException

The action to perform when reads are shut down. By default, this method delegates to the underlying channel.

Exceptions
IOException:
if an error occurs
shutdownWritesback to summary
public void shutdownWrites() throws IOException

Implements org.xnio.channels.SuspendableWriteChannel.shutdownWrites.

Perform the write shutdown action if it hasn't been performed already.

Exceptions
IOException:
if an I/O error occurs
shutdownWritesActionback to summary
protected void shutdownWritesAction() throws IOException

The action to perform when writes are requested to be shut down. By default, this method delegates to the underlying channel.

Exceptions
IOException:
if an error occurs
shutdownWritesCompleteback to summary
protected void shutdownWritesComplete(final boolean readShutDown) throws IOException

Notification that the channel has successfully flushed after having shut down writes. The underlying channel may not yet be fully flushed at this time.

Parameters
readShutDown:boolean

true if the read side was already shut down, false otherwise

Exceptions
IOException:
if an error occurs
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

suspendReadsback to summary
public void suspendReads()

Implements org.xnio.channels.SuspendableReadChannel.suspendReads.

Doc from org.xnio.channels.SuspendableReadChannel.suspendReads.

Suspend further read notifications on this channel.

suspendWritesback to summary
public void suspendWrites()

Implements org.xnio.channels.SuspendableWriteChannel.suspendWrites.

Doc from org.xnio.channels.SuspendableWriteChannel.suspendWrites.

Suspend further write notifications on this channel.

thisTypedback to summary
protected final C thisTyped()

Get this channel, cast to the implemented channel type.

Returns:C

this

Annotations
@SuppressWarnings:unchecked
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

tryAddReadRequiresExternalback to summary
protected boolean tryAddReadRequiresExternal()

Indicate that read requires an external task to complete.

Returns:boolean

true if the flag was set, false if too many tasks are already outstanding

tryAddWriteRequiresExternalback to summary
protected boolean tryAddWriteRequiresExternal()

Indicate that write requires an external task to complete.

Returns:boolean

true if the flag was set, false if too many tasks are already outstanding

unparkReadWaitersback to summary
private void unparkReadWaiters()
unparkWriteWaitersback to summary
private void unparkWriteWaiters()
wakeupReadsback to summary
public void wakeupReads()

Implements org.xnio.channels.SuspendableReadChannel.wakeupReads.

Doc from org.xnio.channels.SuspendableReadChannel.wakeupReads.

Resume reads on this channel, and force the read listener to be triggered even if the channel isn't actually readable.

wakeupWritesback to summary
public void wakeupWrites()

Implements org.xnio.channels.SuspendableWriteChannel.wakeupWrites.

Doc from org.xnio.channels.SuspendableWriteChannel.wakeupWrites.

Resume writes on this channel, and force the write listener to be triggered even if the channel isn't actually writable.

writeRequiresReadback to summary
protected boolean writeRequiresRead()

Indicate if the channel is not writable until the read handler is called.