Top Description Methods
org.xnio.channels

public Interface SuspendableWriteChannel

extends CloseableChannel
Known Direct Subinterfaces
org.xnio.channels.WritableMessageChannel, org.xnio.channels.WritableMultipointMessageChannel, org.xnio.channels.StreamSinkChannel, org.xnio.channels.SuspendableChannel
Imports
java.io.IOException, .InterruptedIOException, java.util.concurrent.TimeUnit, org.xnio.ChannelListener, .XnioExecutor

A suspendable writable channel. This type of channel is associated with a listener which can suspend and resume writes as needed.

Method Summary

Modifier and TypeMethod and Description
public void
awaitWritable()

Block until this channel becomes writable again.

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

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

public void
close()

Redeclares org.xnio.channels.CloseableChannel.close.

Close this channel.

public boolean

Returns:

true if the message was flushed, or false if the result would block
flush
()

Flush any waiting partial send or write.

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

Redeclares org.xnio.channels.CloseableChannel.getCloseSetter.

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

public ChannelListener.Setter<? extends SuspendableWriteChannel>

Returns:

the setter
getWriteSetter
()

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

public XnioExecutor

Returns:

the thread, or null if none is configured or available
getWriteThread
()
Deprecated The getIoThread() method should be used instead.

Get the write thread for this channel.

public boolean

Returns:

true if the channel is open, false otherwise
isOpen
()

Redeclares java.nio.channels.Channel.isOpen.

Determine whether this channel is open.

public boolean

Returns:

true if writes are resumed, false if writes are suspended
isWriteResumed
()

Determine whether writes are resumed.

public void
resumeWrites()

Resume writes on this channel.

public void
shutdownWrites()

Indicate that writing is complete for this channel.

public void
suspendWrites()

Suspend further write notifications on this channel.

public void
wakeupWrites()
Deprecated Users should instead submit Runnable tasks to the channel thread when this functionality is needed.

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

Inherited from org.xnio.channels.CloseableChannel:
getIoThreadgetWorker

Method Detail

awaitWritableback to summary
public void awaitWritable() throws IOException

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
InterruptedIOException:
if the operation is interrupted; the thread's interrupt flag will be set as well
Since
1.2
awaitWritableback to summary
public void awaitWritable(long time, TimeUnit timeUnit) throws IOException

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
InterruptedIOException:
if the operation is interrupted; the thread's interrupt flag will be set as well
Since
1.2
closeback to summary
public void close() throws IOException

Redeclares org.xnio.channels.CloseableChannel.close.

Close this channel. If data has been written but not flushed, that data may be discarded, depending on the channel implementation. 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
flushback to summary
public boolean flush() throws IOException

Flush any waiting partial send or write. If there is no data to flush, or if the flush completed successfully, this method will return true. If there is data to flush which cannot be immediately written, this method will return false. If this method returns true after shutdownWrites() was called on this channel, the write listener will no longer be invoked on this channel. If this is case and additionally this is a write-only channel or the read side was previously shut down, then the channel will automatically be closed.

Returns:boolean

true if the message was flushed, or false if the result would block

Exceptions
IOException:
if an I/O error occurs
getCloseSetterback to summary
public ChannelListener.Setter<? extends SuspendableWriteChannel> getCloseSetter()

Redeclares 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 SuspendableWriteChannel>

the setter

getWriteSetterback to summary
public ChannelListener.Setter<? extends SuspendableWriteChannel> getWriteSetter()

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

Returns:ChannelListener.Setter<? extends SuspendableWriteChannel>

the setter

Since
2.0
getWriteThreadback to summary
public XnioExecutor getWriteThread()

Deprecated

The getIoThread() method should be used instead.

Get the write thread for this channel.

Returns:XnioExecutor

the thread, or null if none is configured or available

Annotations
@Deprecated
isOpenback to summary
public boolean isOpen()

Redeclares java.nio.channels.Channel.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

isWriteResumedback to summary
public boolean isWriteResumed()

Determine whether writes are resumed.

Returns:boolean

true if writes are resumed, false if writes are suspended

resumeWritesback to summary
public void resumeWrites()

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

shutdownWritesback to summary
public void shutdownWrites() throws IOException

Indicate that writing is complete for this channel. Further attempts to write data to this channel after this method is invoked will result in an exception. If this method was already called, calling this method again will have no additional effect. After this method is called, any remaining data still must be flushed out via the flush() method; once this is done, if the read side of the channel was shut down, the channel will automatically close.

Exceptions
IOException:
if an I/O error occurs
suspendWritesback to summary
public void suspendWrites()

Suspend further write notifications on this channel.

wakeupWritesback to summary
public void wakeupWrites()

Deprecated

Users should instead submit Runnable tasks to the channel thread when this functionality is needed.

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

Annotations
@Deprecated