Package org.apache.http.impl.nio.reactor
Class DefaultListeningIOReactor
- java.lang.Object
-
- org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor
-
- org.apache.http.impl.nio.reactor.DefaultListeningIOReactor
-
- All Implemented Interfaces:
IOReactor,ListeningIOReactor
public class DefaultListeningIOReactor extends AbstractMultiworkerIOReactor implements ListeningIOReactor
Default implementation ofListeningIOReactor. This class extendsAbstractMultiworkerIOReactorwith capability to listen for incoming connections.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description DefaultListeningIOReactor()Creates an instance of DefaultListeningIOReactor with default configuration.DefaultListeningIOReactor(int workerCount, java.util.concurrent.ThreadFactory threadFactory, HttpParams params)Deprecated.DefaultListeningIOReactor(int workerCount, HttpParams params)Deprecated.DefaultListeningIOReactor(IOReactorConfig config)Creates an instance of DefaultListeningIOReactor with the given configuration.DefaultListeningIOReactor(IOReactorConfig config, java.util.concurrent.ThreadFactory threadFactory)Creates an instance of DefaultListeningIOReactor with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<ListenerEndpoint>getEndpoints()Returns a set of endpoints for this I/O reactor.ListenerEndpointlisten(java.net.SocketAddress address)Opens a new listener endpoint with the given socket address.voidpause()Suspends the I/O reactor preventing it from accepting new connections on all active endpoints.voidresume()Resumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.-
Methods inherited from class org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor
execute, getAuditLog, getStatus, setExceptionHandler, shutdown, shutdown
-
-
-
-
Constructor Detail
-
DefaultListeningIOReactor
public DefaultListeningIOReactor(IOReactorConfig config, java.util.concurrent.ThreadFactory threadFactory) throws IOReactorException
Creates an instance of DefaultListeningIOReactor with the given configuration.- Parameters:
config- I/O reactor configuration.threadFactory- the factory to create threads. Can benull.- Throws:
IOReactorException- in case if a non-recoverable I/O error.- Since:
- 4.2
-
DefaultListeningIOReactor
public DefaultListeningIOReactor(IOReactorConfig config) throws IOReactorException
Creates an instance of DefaultListeningIOReactor with the given configuration.- Parameters:
config- I/O reactor configuration. Can benull.- Throws:
IOReactorException- in case if a non-recoverable I/O error.- Since:
- 4.2
-
DefaultListeningIOReactor
public DefaultListeningIOReactor() throws IOReactorExceptionCreates an instance of DefaultListeningIOReactor with default configuration.- Throws:
IOReactorException- in case if a non-recoverable I/O error.- Since:
- 4.2
-
DefaultListeningIOReactor
@Deprecated public DefaultListeningIOReactor(int workerCount, java.util.concurrent.ThreadFactory threadFactory, HttpParams params) throws IOReactorExceptionDeprecated.- Throws:
IOReactorException
-
DefaultListeningIOReactor
@Deprecated public DefaultListeningIOReactor(int workerCount, HttpParams params) throws IOReactorExceptionDeprecated.- Throws:
IOReactorException
-
-
Method Detail
-
listen
public ListenerEndpoint listen(java.net.SocketAddress address)
Description copied from interface:ListeningIOReactorOpens a new listener endpoint with the given socket address. Once the endpoint is fully initialized it starts accepting incoming connections and propagates I/O activity notifications to the I/O event dispatcher.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.- Specified by:
listenin interfaceListeningIOReactor- Parameters:
address- the socket address to listen on.- Returns:
- listener endpoint.
-
getEndpoints
public java.util.Set<ListenerEndpoint> getEndpoints()
Description copied from interface:ListeningIOReactorReturns a set of endpoints for this I/O reactor.- Specified by:
getEndpointsin interfaceListeningIOReactor- Returns:
- set of endpoints.
-
pause
public void pause() throws java.io.IOExceptionDescription copied from interface:ListeningIOReactorSuspends the I/O reactor preventing it from accepting new connections on all active endpoints.- Specified by:
pausein interfaceListeningIOReactor- Throws:
java.io.IOException- in case of an I/O error.
-
resume
public void resume() throws java.io.IOExceptionDescription copied from interface:ListeningIOReactorResumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.- Specified by:
resumein interfaceListeningIOReactor- Throws:
java.io.IOException- in case of an I/O error.
-
-