-
- All Superinterfaces:
java.lang.AutoCloseable
,java.nio.channels.Channel
,java.io.Closeable
,CloseableChannel
,Configurable
,java.nio.channels.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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
awaitAcceptable()
Block until this channel becomes acceptable again.void
awaitAcceptable(long time, java.util.concurrent.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.ThegetIoThread()
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 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 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.
-
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 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
void awaitAcceptable() throws java.io.IOException
Block until this channel becomes acceptable again. This method may return spuriously before the channel becomes acceptable.- Throws:
java.io.InterruptedIOException
- if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException
- if an I/O error occurs
-
awaitAcceptable
void awaitAcceptable(long time, java.util.concurrent.TimeUnit timeUnit) throws java.io.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 waittimeUnit
- the time unit- Throws:
java.io.InterruptedIOException
- if the operation is interrupted; the thread's interrupt flag will be set as welljava.io.IOException
- if an I/O error occurs
-
getAcceptThread
@Deprecated XnioExecutor 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
-
-