Package org.apache.hc.core5.reactor
Class SingleCoreListeningIOReactor
java.lang.Object
org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor
org.apache.hc.core5.reactor.SingleCoreListeningIOReactor
- All Implemented Interfaces:
Closeable,AutoCloseable,ModalCloseable,ConnectionAcceptor,IOReactor
class SingleCoreListeningIOReactor
extends AbstractSingleCoreIOReactor
implements ConnectionAcceptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Callback<ChannelEntry> private final ConcurrentMap<ListenerEndpointImpl, Boolean> private final AtomicBooleanprivate final IOReactorConfigprivate final Queue<ListenerEndpointRequest> private final longFields inherited from class org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor
selector -
Constructor Summary
ConstructorsConstructorDescriptionSingleCoreListeningIOReactor(Callback<Exception> exceptionCallback, IOReactorConfig ioReactorConfig, Callback<ChannelEntry> callback) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void(package private) voidReturns a set of endpoints for this I/O reactor.listen(SocketAddress address, Object attachment, FutureCallback<ListenerEndpoint> callback) Opens a new listener endpoint with the given socket address.listen(SocketAddress address, FutureCallback<ListenerEndpoint> callback) 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.private voidprocessEvent(SelectionKey key) private voidprocessEvents(int readyCount) private voidvoidresume()Resumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.Methods inherited from class org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor
awaitShutdown, close, close, close, execute, getStatus, initiateShutdown, logException, toString
-
Field Details
-
reactorConfig
-
callback
-
requestQueue
-
endpoints
-
paused
-
selectTimeoutMillis
private final long selectTimeoutMillis
-
-
Constructor Details
-
SingleCoreListeningIOReactor
SingleCoreListeningIOReactor(Callback<Exception> exceptionCallback, IOReactorConfig ioReactorConfig, Callback<ChannelEntry> callback)
-
-
Method Details
-
doTerminate
void doTerminate()- Specified by:
doTerminatein classAbstractSingleCoreIOReactor
-
doExecute
- Specified by:
doExecutein classAbstractSingleCoreIOReactor- Throws:
IOException
-
processEvents
- Throws:
IOException
-
processEvent
- Throws:
IOException
-
listen
public Future<ListenerEndpoint> listen(SocketAddress address, Object attachment, FutureCallback<ListenerEndpoint> callback) Description copied from interface:ConnectionAcceptorOpens 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.- Specified by:
listenin interfaceConnectionAcceptor- Parameters:
address- the socket address to listen on.attachment- the attachment object.callback- the result callback.- Returns:
- listener endpoint.
-
listen
public Future<ListenerEndpoint> listen(SocketAddress address, FutureCallback<ListenerEndpoint> callback) Description copied from interface:ConnectionAcceptorOpens 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.- Specified by:
listenin interfaceConnectionAcceptor- Parameters:
address- the socket address to listen on.callback- the result callback.- Returns:
- listener endpoint.
-
processSessionRequests
- Throws:
IOException
-
getEndpoints
Description copied from interface:ConnectionAcceptorReturns a set of endpoints for this I/O reactor.- Specified by:
getEndpointsin interfaceConnectionAcceptor- Returns:
- set of endpoints.
-
pause
Description copied from interface:ConnectionAcceptorSuspends the I/O reactor preventing it from accepting new connections on all active endpoints.- Specified by:
pausein interfaceConnectionAcceptor- Throws:
IOException- in case of an I/O error.
-
resume
Description copied from interface:ConnectionAcceptorResumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.- Specified by:
resumein interfaceConnectionAcceptor- Throws:
IOException- in case of an I/O error.
-