Top Description Fields Constructors Methods
org.apache.hc.core5.reactor

public Class DefaultConnectingIOReactor

extends AbstractIOReactorBase
Class Inheritance
Imports
java.io.IOException, java.util.concurrent.ThreadFactory, org.apache.hc.core5.concurrent.DefaultThreadFactory, org.apache.hc.core5.function.Callback, .Decorator, org.apache.hc.core5.io.CloseMode, org.apache.hc.core5.util.Args, .TimeValue

Multi-core I/O reactor that can act as ConnectionInitiator Internally this I/O reactor distributes newly created I/O session equally across multiple I/O worker threads for a more optimal resource utilization and a better I/O performance. Usually it is recommended to have one worker I/O reactor per physical CPU core.
Since
4.0

Field Summary

Modifier and TypeField and Description
private final MultiCoreIOReactor
private static final ThreadFactory
private final int
private final SingleCoreIOReactor[]
private final IOWorkers.Selector

Constructor Summary

AccessConstructor and Description
public
DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig ioReactorConfig, final ThreadFactory threadFactory, final Decorator<IOSession> ioSessionDecorator, final Callback<Exception> exceptionCallback, final IOSessionListener sessionListener, final Callback<IOSession> sessionShutdownCallback)

public
DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig config, final Callback<IOSession> sessionShutdownCallback)

public
DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory)

Creates an instance of DefaultConnectingIOReactor with default configuration.

Method Summary

Modifier and TypeMethod and Description
public void
awaitShutdown(final TimeValue
wait time.
waitTime
)

Implements org.apache.hc.core5.reactor.IOReactor.awaitShutdown.

Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.
public void
close(final CloseMode
How to close the receiver.
closeMode
)

Implements org.apache.hc.core5.reactor.IOReactor.close.

Shuts down the I/O reactor either gracefully or immediately.
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public IOReactorStatus
getStatus()

Implements org.apache.hc.core5.reactor.IOReactor.getStatus.

Returns the current status of the reactor.
pack-priv IOWorkers.Selector
public void
initiateShutdown()

Implements org.apache.hc.core5.reactor.IOReactor.initiateShutdown.

Initiates shutdown of the reactor without blocking.
public void
Inherited from org.apache.hc.core5.reactor.AbstractIOReactorBase:
connect

Field Detail

ioReactorback to summary
private final MultiCoreIOReactor ioReactor
THREAD_FACTORYback to summary
private static final ThreadFactory THREAD_FACTORY
workerCountback to summary
private final int workerCount
workersback to summary
private final SingleCoreIOReactor[] workers
workerSelectorback to summary
private final IOWorkers.Selector workerSelector

Constructor Detail

DefaultConnectingIOReactorback to summary
public DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig ioReactorConfig, final ThreadFactory threadFactory, final Decorator<IOSession> ioSessionDecorator, final Callback<Exception> exceptionCallback, final IOSessionListener sessionListener, final Callback<IOSession> sessionShutdownCallback)
DefaultConnectingIOReactorback to summary
public DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory, final IOReactorConfig config, final Callback<IOSession> sessionShutdownCallback)
DefaultConnectingIOReactorback to summary
public DefaultConnectingIOReactor(final IOEventHandlerFactory eventHandlerFactory)

Creates an instance of DefaultConnectingIOReactor with default configuration.

Since
5.0

Method Detail

awaitShutdownback to summary
public void awaitShutdown(final TimeValue waitTime) throws InterruptedException

Implements org.apache.hc.core5.reactor.IOReactor.awaitShutdown.

Doc from org.apache.hc.core5.reactor.IOReactor.awaitShutdown.

Blocks for the given period of time in milliseconds awaiting the completion of the reactor shutdown.

Parameters
waitTime:TimeValue

wait time.

Annotations
@Override
closeback to summary
public void close(final CloseMode closeMode)

Implements org.apache.hc.core5.reactor.IOReactor.close.

Doc from org.apache.hc.core5.reactor.IOReactor.close.

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.

Parameters
closeMode:CloseMode

Doc from org.apache.hc.core5.io.ModalCloseable.close.

How to close the receiver.

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
getStatusback to summary
public IOReactorStatus getStatus()

Implements org.apache.hc.core5.reactor.IOReactor.getStatus.

Doc from org.apache.hc.core5.reactor.IOReactor.getStatus.

Returns the current status of the reactor.

Returns:IOReactorStatus

reactor status.

Annotations
@Override
getWorkerSelectorback to summary
pack-priv IOWorkers.Selector getWorkerSelector()

Implements abstract org.apache.hc.core5.reactor.AbstractIOReactorBase.getWorkerSelector.

Annotations
@Override
initiateShutdownback to summary
public void initiateShutdown()

Implements org.apache.hc.core5.reactor.IOReactor.initiateShutdown.

Doc from org.apache.hc.core5.reactor.IOReactor.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

Annotations
@Override
startback to summary
public void start()

Implements org.apache.hc.core5.reactor.IOReactorService.start.

Doc from org.apache.hc.core5.reactor.IOReactorService.start.

Starts I/O reactor.

Annotations
@Override