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:
java.io.Closeable,java.lang.AutoCloseable,ModalCloseable,ConnectionAcceptor,IOReactor
class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implements ConnectionAcceptor
-
-
Field Summary
Fields Modifier and Type Field Description private Callback<ChannelEntry>callbackprivate java.util.concurrent.ConcurrentMap<ListenerEndpointImpl,java.lang.Boolean>endpointsprivate java.util.concurrent.atomic.AtomicBooleanpausedprivate IOReactorConfigreactorConfigprivate java.util.Queue<ListenerEndpointRequest>requestQueueprivate longselectTimeoutMillis-
Fields inherited from class org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor
selector
-
-
Constructor Summary
Constructors Constructor Description SingleCoreListeningIOReactor(Callback<java.lang.Exception> exceptionCallback, IOReactorConfig ioReactorConfig, Callback<ChannelEntry> callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoExecute()(package private) voiddoTerminate()java.util.Set<ListenerEndpoint>getEndpoints()Returns a set of endpoints for this I/O reactor.java.util.concurrent.Future<ListenerEndpoint>listen(java.net.SocketAddress address, java.lang.Object attachment, FutureCallback<ListenerEndpoint> callback)Opens a new listener endpoint with the given socket address.java.util.concurrent.Future<ListenerEndpoint>listen(java.net.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(java.nio.channels.SelectionKey key)private voidprocessEvents(int readyCount)private voidprocessSessionRequests()voidresume()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 Detail
-
reactorConfig
private final IOReactorConfig reactorConfig
-
callback
private final Callback<ChannelEntry> callback
-
requestQueue
private final java.util.Queue<ListenerEndpointRequest> requestQueue
-
endpoints
private final java.util.concurrent.ConcurrentMap<ListenerEndpointImpl,java.lang.Boolean> endpoints
-
paused
private final java.util.concurrent.atomic.AtomicBoolean paused
-
selectTimeoutMillis
private final long selectTimeoutMillis
-
-
Constructor Detail
-
SingleCoreListeningIOReactor
SingleCoreListeningIOReactor(Callback<java.lang.Exception> exceptionCallback, IOReactorConfig ioReactorConfig, Callback<ChannelEntry> callback)
-
-
Method Detail
-
doTerminate
void doTerminate()
- Specified by:
doTerminatein classAbstractSingleCoreIOReactor
-
doExecute
protected final void doExecute() throws java.io.IOException- Specified by:
doExecutein classAbstractSingleCoreIOReactor- Throws:
java.io.IOException
-
processEvents
private void processEvents(int readyCount) throws java.io.IOException- Throws:
java.io.IOException
-
processEvent
private void processEvent(java.nio.channels.SelectionKey key) throws java.io.IOException- Throws:
java.io.IOException
-
listen
public java.util.concurrent.Future<ListenerEndpoint> listen(java.net.SocketAddress address, java.lang.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 java.util.concurrent.Future<ListenerEndpoint> listen(java.net.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
private void processSessionRequests() throws java.io.IOException- Throws:
java.io.IOException
-
getEndpoints
public java.util.Set<ListenerEndpoint> getEndpoints()
Description copied from interface:ConnectionAcceptorReturns a set of endpoints for this I/O reactor.- Specified by:
getEndpointsin interfaceConnectionAcceptor- Returns:
- set of endpoints.
-
pause
public void pause() throws java.io.IOExceptionDescription copied from interface:ConnectionAcceptorSuspends the I/O reactor preventing it from accepting new connections on all active endpoints.- Specified by:
pausein interfaceConnectionAcceptor- Throws:
java.io.IOException- in case of an I/O error.
-
resume
public void resume() throws java.io.IOExceptionDescription copied from interface:ConnectionAcceptorResumes the I/O reactor restoring its ability to accept incoming connections on all active endpoints.- Specified by:
resumein interfaceConnectionAcceptor- Throws:
java.io.IOException- in case of an I/O error.
-
-