XNIO API 3.0.4.GA

org.xnio.channels
Interface SuspendableAcceptChannel

All Superinterfaces:
Channel, Closeable, CloseableChannel, Configurable, InterruptibleChannel
All Known Subinterfaces:
AcceptingChannel<C>, SimpleAcceptingChannel<C>

public interface SuspendableAcceptChannel
extends CloseableChannel

A suspendable accept channel. This type of channel is associated with a listener which can suspend and resume accepting connections as needed.

Since:
3.0

Method Summary
 void awaitAcceptable()
          Block until this channel becomes acceptable again.
 void awaitAcceptable(long time, TimeUnit timeUnit)
          Block until this channel becomes acceptable again, or until the timeout expires.
 ChannelListener.Setter<? extends SuspendableAcceptChannel> getAcceptSetter()
          Get the setter which can be used to change the accept listener for this channel.
 ChannelListener.Setter<? extends SuspendableAcceptChannel> getCloseSetter()
          Get the setter which can be used to change the close listener for this channel.
 void resumeAccepts()
          Resume reads on this channel.
 void suspendAccepts()
          Suspend further read notifications on this channel.
 void wakeupAccepts()
          resumeAccepts() Resume accepts} on this channel, and force the accept listener to be triggered even if the channel isn't actually ready.
 
Methods inherited from interface org.xnio.channels.CloseableChannel
close, getWorker
 
Methods inherited from interface java.nio.channels.Channel
isOpen
 
Methods inherited from interface org.xnio.channels.Configurable
getOption, setOption, supportsOption
 

Method Detail

suspendAccepts

void suspendAccepts()
Suspend further read notifications on this channel.


resumeAccepts

void resumeAccepts()
Resume reads on this channel. The accept listener will be called as soon as there is a connection available to be accepted.


wakeupAccepts

void wakeupAccepts()
resumeAccepts() Resume accepts} on this channel, and force the accept listener to be triggered even if the channel isn't actually ready.


awaitAcceptable

void awaitAcceptable()
                     throws IOException
Block until this channel becomes acceptable again. This method may return spuriously before the channel becomes acceptable.

Throws:
InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
IOException - if an I/O error occurs

awaitAcceptable

void awaitAcceptable(long time,
                     TimeUnit timeUnit)
                     throws IOException
Block until this channel becomes acceptable again, or until the timeout expires. This method may return spuriously before the channel becomes acceptable or the timeout expires.

Parameters:
time - the time to wait
timeUnit - the time unit
Throws:
InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as well
IOException - if an I/O error occurs

getAcceptSetter

ChannelListener.Setter<? extends SuspendableAcceptChannel> getAcceptSetter()
Get the setter which can be used to change the accept listener for this channel. When the listener is called, additional notifications are automatically suspended.

Returns:
the setter

getCloseSetter

ChannelListener.Setter<? extends SuspendableAcceptChannel> 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.

Specified by:
getCloseSetter in interface CloseableChannel
Returns:
the setter

XNIO API 3.0.4.GA

Copyright © 2010 JBoss, a division of Red Hat, Inc.