public class DefaultListeningIOReactor extends AbstractMultiworkerIOReactor implements ListeningIOReactor
ListeningIOReactor
. This class extends
AbstractMultiworkerIOReactor
with capability to listen for incoming
connections.AbstractMultiworkerIOReactor.DefaultThreadFactory, AbstractMultiworkerIOReactor.Worker
Modifier and Type | Field and Description |
---|---|
private Set<ListenerEndpointImpl> |
endpoints |
private boolean |
paused |
private Set<SocketAddress> |
pausedEndpoints |
private Queue<ListenerEndpointImpl> |
requestQueue |
auditLog, config, exceptionHandler, interestOpsQueueing, params, selector, selectTimeout, status
Constructor and Description |
---|
DefaultListeningIOReactor()
Creates an instance of DefaultListeningIOReactor with default configuration.
|
DefaultListeningIOReactor(int workerCount,
HttpParams params)
Deprecated.
|
DefaultListeningIOReactor(int workerCount,
ThreadFactory threadFactory,
HttpParams params)
Deprecated.
|
DefaultListeningIOReactor(IOReactorConfig config)
Creates an instance of DefaultListeningIOReactor with the given configuration.
|
DefaultListeningIOReactor(IOReactorConfig config,
ThreadFactory threadFactory)
Creates an instance of DefaultListeningIOReactor with the given configuration.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cancelRequests()
Triggered to cancel pending session requests.
|
private ListenerEndpointImpl |
createEndpoint(SocketAddress address) |
Set<ListenerEndpoint> |
getEndpoints()
Returns a set of endpoints for this I/O reactor.
|
ListenerEndpoint |
listen(SocketAddress address)
Opens a new listener endpoint with the given socket address.
|
void |
pause()
Suspends the I/O reactor preventing it from accepting new connections on
all active endpoints.
|
private void |
processEvent(SelectionKey key) |
protected void |
processEvents(int readyCount)
Triggered to process I/O events registered by the main
Selector . |
private void |
processSessionRequests() |
void |
resume()
Resumes the I/O reactor restoring its ability to accept incoming
connections on all active endpoints.
|
addChannel, addExceptionEvent, addExceptionEvent, awaitShutdown, closeChannel, convert, doShutdown, execute, getAuditLog, getStatus, prepareSocket, registerChannel, setExceptionHandler, shutdown, shutdown
private final Queue<ListenerEndpointImpl> requestQueue
private final Set<ListenerEndpointImpl> endpoints
private final Set<SocketAddress> pausedEndpoints
private volatile boolean paused
public DefaultListeningIOReactor(IOReactorConfig config, ThreadFactory threadFactory) throws IOReactorException
config
- I/O reactor configuration.threadFactory
- the factory to create threads.
Can be null
.IOReactorException
- in case if a non-recoverable I/O error.public DefaultListeningIOReactor(IOReactorConfig config) throws IOReactorException
config
- I/O reactor configuration.
Can be null
.IOReactorException
- in case if a non-recoverable I/O error.public DefaultListeningIOReactor() throws IOReactorException
IOReactorException
- in case if a non-recoverable I/O error.@Deprecated public DefaultListeningIOReactor(int workerCount, ThreadFactory threadFactory, HttpParams params) throws IOReactorException
DefaultListeningIOReactor(IOReactorConfig, ThreadFactory)
IOReactorException
@Deprecated public DefaultListeningIOReactor(int workerCount, HttpParams params) throws IOReactorException
DefaultListeningIOReactor(IOReactorConfig)
IOReactorException
protected void cancelRequests() throws IOReactorException
AbstractMultiworkerIOReactor
Super-classes can implement this method to react to the event.
cancelRequests
in class AbstractMultiworkerIOReactor
IOReactorException
- in case if a non-recoverable I/O error.protected void processEvents(int readyCount) throws IOReactorException
AbstractMultiworkerIOReactor
Selector
.
Super-classes can implement this method to react to the event.
processEvents
in class AbstractMultiworkerIOReactor
readyCount
- event count.IOReactorException
- in case if a non-recoverable I/O error.private void processEvent(SelectionKey key) throws IOReactorException
IOReactorException
private ListenerEndpointImpl createEndpoint(SocketAddress address)
public ListenerEndpoint listen(SocketAddress address)
ListeningIOReactor
ListenerEndpoint.waitFor()
can be used to wait for the
listener to be come ready to accept incoming connections.
ListenerEndpoint.close()
can be used to shut down
the listener even before it is fully initialized.
listen
in interface ListeningIOReactor
address
- the socket address to listen on.private void processSessionRequests() throws IOReactorException
IOReactorException
public Set<ListenerEndpoint> getEndpoints()
ListeningIOReactor
getEndpoints
in interface ListeningIOReactor
public void pause() throws IOException
ListeningIOReactor
pause
in interface ListeningIOReactor
IOException
- in case of an I/O error.public void resume() throws IOException
ListeningIOReactor
resume
in interface ListeningIOReactor
IOException
- in case of an I/O error.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses