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 AtomicBoolean
private final IOReactorConfig
private final Queue
<ListenerEndpointRequest> private final long
Fields 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) void
Returns 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.void
pause()
Suspends the I/O reactor preventing it from accepting new connections on all active endpoints.private void
processEvent
(SelectionKey key) private void
processEvents
(int readyCount) private void
void
resume()
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:
doTerminate
in classAbstractSingleCoreIOReactor
-
doExecute
- Specified by:
doExecute
in 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:ConnectionAcceptor
Opens 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:
listen
in 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:ConnectionAcceptor
Opens 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:
listen
in interfaceConnectionAcceptor
- Parameters:
address
- the socket address to listen on.callback
- the result callback.- Returns:
- listener endpoint.
-
processSessionRequests
- Throws:
IOException
-
getEndpoints
Description copied from interface:ConnectionAcceptor
Returns a set of endpoints for this I/O reactor.- Specified by:
getEndpoints
in interfaceConnectionAcceptor
- Returns:
- set of endpoints.
-
pause
Description copied from interface:ConnectionAcceptor
Suspends the I/O reactor preventing it from accepting new connections on all active endpoints.- Specified by:
pause
in interfaceConnectionAcceptor
- Throws:
IOException
- in case of an I/O error.
-
resume
Description copied from interface:ConnectionAcceptor
Resumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.- Specified by:
resume
in interfaceConnectionAcceptor
- Throws:
IOException
- in case of an I/O error.
-