Package org.xnio.channels

# Interface SuspendableAcceptChannel

All Superinterfaces:
  `AutoCloseable`, `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

## Field Summary

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

## Method Summary

Modifier and Type
Method
Description
`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.
`XnioExecutor`
`getAcceptThread()`
Deprecated.
The `getIoThread()` method should be used instead.
`ChannelListener.Setter<? extends SuspendableAcceptChannel>`
`getCloseSetter()`
Get the setter which can be used to change the close listener for this channel.
`XnioIoThread`
`getIoThread()`
Get an accept thread for this channel.
`boolean`
`isAcceptResumed()`
Determine whether accepts are resumed.
`void`
`resumeAccepts()`
Resume reads on this channel.
`void`
`suspendAccepts()`
Suspend further read notifications on this channel.
`void`
`wakeupAccepts()`
Deprecated.
Users should instead submit `Runnable` tasks to the channel thread when this functionality is needed.

### Methods inherited from interface java.nio.channels.Channel

`isOpen`

### Methods inherited from interface org.xnio.channels.CloseableChannel

`close, getWorker`

### Methods inherited from interface org.xnio.channels.Configurable

`getOption, setOption, supportsOption`

## Method Details

### 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.

### isAcceptResumed

boolean isAcceptResumed()
Determine whether accepts are resumed.

Returns:
  `true` if accepts are resumed, `false` if accepts are suspended

### wakeupAccepts

@Deprecated void wakeupAccepts()
Deprecated.
Users should instead submit `Runnable` tasks to the channel thread when this functionality is needed.
`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

### getAcceptThread

@Deprecated XnioExecutor getAcceptThread()
Deprecated.
The `getIoThread()` method should be used instead.
Get an accept thread for this channel. If more than one is configured, any of them may be returned.

Returns:
  the thread

### getIoThread

XnioIoThread getIoThread()
Get an accept thread for this channel. If more than one is configured, any of them may be returned.

Specified by:
  `getIoThread` in interface `CloseableChannel`
Returns:
  the thread

### getAcceptSetter

ChannelListener.Setter<? extends SuspendableAcceptChannel> getAcceptSetter()
Get the setter which can be used to change the accept listener for this channel.

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