Example usage for org.apache.http.nio.conn NHttpClientConnectionManager execute

List of usage examples for org.apache.http.nio.conn NHttpClientConnectionManager execute

Introduction

In this page you can find the example usage for org.apache.http.nio.conn NHttpClientConnectionManager execute.

Prototype

void execute(IOEventDispatch eventDispatch) throws IOException;

Source Link

Document

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

Usage

From source file:org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.java

public CloseableHttpAsyncClientBase(final NHttpClientConnectionManager connmgr,
        final ThreadFactory threadFactory, final NHttpClientEventHandler handler) {
    super();/*w  ww . java2 s  .  c o  m*/
    this.connmgr = connmgr;
    if (threadFactory != null && handler != null) {
        this.reactorThread = threadFactory.newThread(new Runnable() {

            @Override
            public void run() {
                try {
                    final IOEventDispatch ioEventDispatch = new InternalIODispatch(handler);
                    connmgr.execute(ioEventDispatch);
                } catch (final Exception ex) {
                    log.error("I/O reactor terminated abnormally", ex);
                } finally {
                    status.set(Status.STOPPED);
                }
            }

        });
    } else {
        this.reactorThread = null;
    }
    this.status = new AtomicReference<Status>(Status.INACTIVE);
}