Package org.apache.http.impl.nio.reactor
Class AbstractIOReactor
java.lang.Object
org.apache.http.impl.nio.reactor.AbstractIOReactor
- All Implemented Interfaces:
IOReactor
- Direct Known Subclasses:
BaseIOReactor
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
ConstructorsConstructorDescriptionAbstractIOReactor(long selectTimeout) Creates new AbstractIOReactor instance.AbstractIOReactor(long selectTimeout, boolean interestOpsQueueing) Creates new AbstractIOReactor instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChannel(ChannelEntry channelEntry) Adds new channel entry.voidawaitShutdown(long timeout) Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.booleanReturnstrueif interest Ops queueing is enabled,falseotherwise.Returns the current status of the reactor.voidAttempts graceful shutdown of this I/O reactor.voidAttempts force-shutdown of this I/O reactor.voidshutdown()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.voidshutdown(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.
-
Constructor Details
-
AbstractIOReactor
Creates new AbstractIOReactor instance.- Parameters:
selectTimeout- the select timeout.- Throws:
IOReactorException- in case if a non-recoverable I/O error.
-
AbstractIOReactor
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
Description copied from interface:IOReactorReturns the current status of the reactor. -
getInterestOpsQueueing
public boolean getInterestOpsQueueing()Returnstrueif interest Ops queueing is enabled,falseotherwise.- Since:
- 4.1
-
addChannel
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
Attempts force-shutdown of this I/O reactor.- Throws:
IOReactorException
-
awaitShutdown
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
Description copied from interface:IOReactorInitiates 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:
shutdownin interfaceIOReactor- Parameters:
gracePeriod- wait time in milliseconds.- Throws:
IOReactorException
-
shutdown
Description copied from interface:IOReactorInitiates 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:
shutdownin interfaceIOReactor- Throws:
IOReactorException
-