org.jboss.xnio.channels
Interface SuspendableWriteChannel

All Superinterfaces:
java.nio.channels.Channel, java.io.Closeable, Configurable
All Known Subinterfaces:
AllocatedMessageChannel, ConnectedStreamChannel<A>, DatagramChannel<A>, MessageChannel, MultipointDatagramChannel<A>, MultipointMessageChannel<A>, MultipointWritableMessageChannel<A>, StreamChannel, StreamSinkChannel, SuspendableChannel, TcpChannel, UdpChannel, WritableMessageChannel
All Known Implementing Classes:
BioDatagramChannelImpl, BioMulticastChannelImpl, NioPipeChannelImpl, NioPipeSinkChannelImpl, NioTcpChannel, NioUdpSocketChannelImpl

public interface SuspendableWriteChannel
extends java.nio.channels.Channel, Configurable

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


Method Summary
 void awaitWritable()
          Block until this channel becomes writable again.
 void awaitWritable(long time, java.util.concurrent.TimeUnit timeUnit)
          Block until this channel becomes writable again, or until the timeout expires.
 void resumeWrites()
          Resume writes on this channel.
 void shutdownWrites()
          Indicate that writing is complete for this channel.
 void suspendWrites()
          Suspend further writes on this channel.
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface org.jboss.xnio.channels.Configurable
getOption, getOptions, setOption
 

Method Detail

suspendWrites

void suspendWrites()
Suspend further writes on this channel. The IoWriteHandler.handleWritable(java.nio.channels.Channel) method will not be called until writes are resumed.


resumeWrites

void resumeWrites()
Resume writes on this channel. The IoWriteHandler.handleWritable(java.nio.channels.Channel) method will be called as soon as there is space in the channel's transmit buffer.


shutdownWrites

void shutdownWrites()
                    throws java.io.IOException
Indicate that writing is complete for this channel. Further attempts to write after shutdown will result in an exception.

Throws:
java.io.IOException - if an I/O error occurs

awaitWritable

void awaitWritable()
                   throws java.io.IOException
Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.

Throws:
java.io.IOException - if an I/O error occurs
Since:
1.2

awaitWritable

void awaitWritable(long time,
                   java.util.concurrent.TimeUnit timeUnit)
                   throws java.io.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 - the time to wait
timeUnit - the time unit
Throws:
java.io.IOException - if an I/O error occurs
Since:
1.2