public interface

IOReactor

org.apache.http.nio.reactor.IOReactor
Known Indirect Subclasses

Class Overview

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.

Summary

Public Methods
abstract void execute(IOEventDispatch eventDispatch)
Starts the reactor and initiates the dispatch of I/O event notifications to the given IOEventDispatch.
abstract IOReactorStatus getStatus()
Returns the current status of the reactor.
abstract void shutdown(long waitMs)
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.
abstract void shutdown()
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.

Public Methods

public abstract void execute (IOEventDispatch eventDispatch)

Starts the reactor and initiates the dispatch of I/O event notifications to the given IOEventDispatch.

Parameters
eventDispatch the I/O event dispatch.
Throws
IOException in case of an I/O error.

public abstract IOReactorStatus getStatus ()

Returns the current status of the reactor.

Returns
  • reactor status.

public abstract void shutdown (long waitMs)

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.

Parameters
waitMs wait time in milliseconds.
Throws
IOException in case of an I/O error.

public abstract void shutdown ()

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.

Throws
IOException in case of an I/O error.