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
public abstract class AbstractIOReactor extends java.lang.Object implements IOReactor
Generic implementation ofIOReactorthat can used as a subclass for more specialized I/O reactors. It is based on a singleSelectorinstance.- 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChannel(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.booleangetInterestOpsQueueing()Returnstrueif interest Ops queueing is enabled,falseotherwise.IOReactorStatusgetStatus()Returns the current status of the reactor.voidgracefulShutdown()Attempts graceful shutdown of this I/O reactor.voidhardShutdown()Attempts 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 Detail
-
AbstractIOReactor
public AbstractIOReactor(long selectTimeout) throws IOReactorExceptionCreates 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 IOReactorExceptionCreates 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 Detail
-
getStatus
public IOReactorStatus 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
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 IOReactorExceptionAttempts force-shutdown of this I/O reactor.- Throws:
IOReactorException
-
awaitShutdown
public void awaitShutdown(long timeout) throws java.lang.InterruptedExceptionBlocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.- Parameters:
timeout- the maximum wait time.- Throws:
java.lang.InterruptedException- if interrupted.
-
shutdown
public void shutdown(long gracePeriod) throws IOReactorExceptionDescription 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
public void shutdown() throws IOReactorExceptionDescription 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
-
-