Class AbstractIOReactor

java.lang.Object
org.apache.http.impl.nio.reactor.AbstractIOReactor
All Implemented Interfaces:
IOReactor
Direct Known Subclasses:
BaseIOReactor

public abstract class AbstractIOReactor extends Object implements IOReactor
Generic implementation of IOReactor that can used as a subclass for more specialized I/O reactors. It is based on a single Selector instance.
Since:
4.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractIOReactor(long selectTimeout)
    Creates new AbstractIOReactor instance.
    AbstractIOReactor(long selectTimeout, boolean interestOpsQueueing)
    Creates new AbstractIOReactor instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addChannel(ChannelEntry channelEntry)
    Adds new channel entry.
    void
    awaitShutdown(long timeout)
    Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.
    boolean
    Returns true if interest Ops queueing is enabled, false otherwise.
    Returns the current status of the reactor.
    void
    Attempts graceful shutdown of this I/O reactor.
    void
    Attempts force-shutdown of this I/O reactor.
    void
    Initiates shutdown of the reactor and blocks for a default period of time waiting for the reactor to terminate all active connections, to shut down itself and to release system resources it currently holds.
    void
    shutdown(long gracePeriod)
    Initiates shutdown of the reactor and blocks approximately for the given period of time in milliseconds waiting for the reactor to terminate all active connections, to shut down itself and to release system resources it currently holds.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.http.nio.reactor.IOReactor

    execute
  • Constructor Details

    • AbstractIOReactor

      public AbstractIOReactor(long selectTimeout) throws IOReactorException
      Creates new AbstractIOReactor instance.
      Parameters:
      selectTimeout - the select timeout.
      Throws:
      IOReactorException - in case if a non-recoverable I/O error.
    • AbstractIOReactor

      public AbstractIOReactor(long selectTimeout, boolean interestOpsQueueing) throws IOReactorException
      Creates new AbstractIOReactor instance.
      Parameters:
      selectTimeout - the select timeout.
      interestOpsQueueing - Ops queueing flag.
      Throws:
      IOReactorException - in case if a non-recoverable I/O error.
      Since:
      4.1
  • Method Details

    • getStatus

      public IOReactorStatus getStatus()
      Description copied from interface: IOReactor
      Returns the current status of the reactor.
      Specified by:
      getStatus in interface IOReactor
      Returns:
      reactor status.
    • getInterestOpsQueueing

      public boolean getInterestOpsQueueing()
      Returns true if interest Ops queueing is enabled, false otherwise.
      Since:
      4.1
    • addChannel

      public void addChannel(ChannelEntry channelEntry)
      Adds new channel entry. The channel will be asynchronously registered with the selector.
      Parameters:
      channelEntry - the channel entry.
    • gracefulShutdown

      public void gracefulShutdown()
      Attempts graceful shutdown of this I/O reactor.
    • hardShutdown

      public void hardShutdown() throws IOReactorException
      Attempts force-shutdown of this I/O reactor.
      Throws:
      IOReactorException
    • awaitShutdown

      public void awaitShutdown(long timeout) throws InterruptedException
      Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.
      Parameters:
      timeout - the maximum wait time.
      Throws:
      InterruptedException - if interrupted.
    • shutdown

      public void shutdown(long gracePeriod) throws IOReactorException
      Description copied from interface: IOReactor
      Initiates shutdown of the reactor and blocks approximately for the given period of time in milliseconds waiting for the reactor to terminate all active connections, to shut down itself and to release system resources it currently holds.
      Specified by:
      shutdown in interface IOReactor
      Parameters:
      gracePeriod - wait time in milliseconds.
      Throws:
      IOReactorException
    • shutdown

      public void shutdown() throws IOReactorException
      Description copied from interface: IOReactor
      Initiates shutdown of the reactor and blocks for a default period of time waiting for the reactor to terminate all active connections, to shut down itself and to release system resources it currently holds. It is up to individual implementations to decide for how long this method can remain blocked.
      Specified by:
      shutdown in interface IOReactor
      Throws:
      IOReactorException