- All Superinterfaces:
AutoCloseable
,Channel
,Closeable
,CloseableChannel
,Configurable
,InterruptibleChannel
- All Known Subinterfaces:
AcceptingChannel<C>
,SimpleAcceptingChannel<C>
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 TypeMethodDescriptionvoid
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>
Get the setter which can be used to change the accept listener for this channel.Deprecated.ChannelListener.Setter<? extends SuspendableAcceptChannel>
Get the setter which can be used to change the close listener for this channel.Get an accept thread for this channel.boolean
Determine whether accepts are resumed.void
Resume reads on this channel.void
Suspend further read notifications on this channel.void
Deprecated.Users should instead submitRunnable
tasks to the channel thread when this functionality is needed.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.Users should instead submitRunnable
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
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 wellIOException
- if an I/O error occurs
-
awaitAcceptable
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 waittimeUnit
- the time unit- Throws:
InterruptedIOException
- if the operation is interrupted; the thread's interrupt flag will be set as wellIOException
- if an I/O error occurs
-
getAcceptThread
Deprecated.ThegetIoThread()
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 interfaceCloseableChannel
- 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 interfaceCloseableChannel
- Returns:
- the setter
-
getIoThread()
method should be used instead.