Package org.apache.hc.core5.reactor
Interface IOReactor
- All Superinterfaces:
AutoCloseable
,Closeable
,ModalCloseable
- All Known Subinterfaces:
IOReactorService
- All Known Implementing Classes:
AbstractIOReactorBase
,AbstractSingleCoreIOReactor
,AsyncRequester
,AsyncServer
,DefaultConnectingIOReactor
,DefaultListeningIOReactor
,H2AsyncRequester
,H2MultiplexingRequester
,HttpAsyncRequester
,HttpAsyncServer
,MultiCoreIOReactor
,SingleCoreIOReactor
,SingleCoreListeningIOReactor
HttpCore NIO is based on the Reactor pattern as described by Doug Lea.
The purpose of I/O reactors is to react to I/O events and to dispatch event
notifications to individual I/O sessions. The main idea of I/O reactor
pattern is to break away from the one thread per connection model imposed
by the classic blocking I/O model.
The IOReactor interface represents an abstract object implementing the Reactor pattern.
I/O reactors usually employ a small number of dispatch threads (often as few as one) to dispatch I/O event notifications to a much greater number (often as many as several thousands) of I/O sessions or connections. It is generally recommended to have one dispatch thread per CPU core.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
awaitShutdown
(TimeValue waitTime) Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.void
Shuts down the I/O reactor either gracefully or immediately.Returns the current status of the reactor.void
Initiates shutdown of the reactor without blocking.
-
Method Details
-
close
Shuts down the I/O reactor either gracefully or immediately. During graceful shutdown individual I/O sessions should be informed about imminent termination and be given a grace period to complete the ongoing I/O sessions. During immediate shutdown all ongoing I/O sessions get aborted immediately.- Specified by:
close
in interfaceModalCloseable
- Parameters:
closeMode
- How to close the receiver.
-
getStatus
IOReactorStatus getStatus()Returns the current status of the reactor.- Returns:
- reactor status.
-
initiateShutdown
void initiateShutdown()Initiates shutdown of the reactor without blocking. The reactor is expected to terminate all active connections, to shut down itself and to release system resources it currently holds- Since:
- 5.0
-
awaitShutdown
Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.- Parameters:
waitTime
- wait time.- Throws:
InterruptedException
- Since:
- 5.0
-