org.apache.hc.core5.reactor

## Interface IOReactor

- All Superinterfaces:
    AutoCloseable, Closeable, ModalCloseable
  All Known Subinterfaces:
    IOReactorService
  All Known Implementing Classes:
    AsyncRequester, AsyncServer, DefaultConnectingIOReactor, DefaultListeningIOReactor, H2AsyncRequester, H2MultiplexingRequester, HttpAsyncRequester, HttpAsyncServer

      public interface IOReactor
      extends ModalCloseable

  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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `awaitShutdown(TimeValue waitTime)` Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.
    `void` | `close(CloseMode closeMode)` Shuts down the I/O reactor either gracefully or immediately.
    `IOReactorStatus` | `getStatus()` Returns the current status of the reactor.
    `void` | `initiateShutdown()` Initiates shutdown of the reactor without blocking.

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Method Detail

    - #### close

          void close(CloseMode closeMode)

      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 interface `ModalCloseable`
      Parameters:
        `closeMode` - How to close the I/O reactor.

    - #### 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

          void awaitShutdown(TimeValue waitTime)
                             throws InterruptedException

      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

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.