Search in sources :

Example 11 with ChannelManagerFactory

use of org.webpieces.nio.api.ChannelManagerFactory in project webpieces by deanhiller.

the class HttpClientFactory method createHttpClient.

public static HttpClient createHttpClient(int numThreads) {
    Executor executor = Executors.newFixedThreadPool(numThreads, new NamedThreadFactory("httpclient"));
    BufferCreationPool pool = new BufferCreationPool();
    HttpParser parser = HttpParserFactory.createParser(pool);
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager mgr = factory.createMultiThreadedChanMgr("httpClientChanMgr", pool, executor);
    return createHttpClient(mgr, parser);
}
Also used : Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) HttpParser(org.webpieces.httpparser.api.HttpParser) BufferCreationPool(org.webpieces.data.api.BufferCreationPool) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory)

Example 12 with ChannelManagerFactory

use of org.webpieces.nio.api.ChannelManagerFactory in project webpieces by deanhiller.

the class Http2ClientFactory method createHttpClient.

public static Http2Client createHttpClient(int numThreads) {
    Http2Config config = new Http2Config();
    Executor executor = Executors.newFixedThreadPool(numThreads, new NamedThreadFactory("httpclient"));
    BufferCreationPool pool = new BufferCreationPool();
    HpackParser hpackParser = HpackParserFactory.createParser(pool, false);
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager mgr = factory.createMultiThreadedChanMgr("httpClientChanMgr", pool, executor);
    InjectionConfig injConfig = new InjectionConfig(hpackParser, new TimeImpl(), config);
    return createHttpClient(mgr, injConfig);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) Executor(java.util.concurrent.Executor) ChannelManager(org.webpieces.nio.api.ChannelManager) NamedThreadFactory(org.webpieces.util.threading.NamedThreadFactory) Http2Config(com.webpieces.http2engine.api.client.Http2Config) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) BufferCreationPool(org.webpieces.data.api.BufferCreationPool) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory) TimeImpl(com.webpieces.util.time.TimeImpl)

Aggregations

ChannelManager (org.webpieces.nio.api.ChannelManager)12 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)12 Executor (java.util.concurrent.Executor)8 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)8 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)7 AsyncServerManager (org.webpieces.asyncserver.api.AsyncServerManager)4 BufferPool (org.webpieces.data.api.BufferPool)4 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)4 HpackParser (com.webpieces.hpack.api.HpackParser)3 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)3 InetSocketAddress (java.net.InetSocketAddress)3 AsyncConfig (org.webpieces.asyncserver.api.AsyncConfig)3 AsyncServer (org.webpieces.asyncserver.api.AsyncServer)3 HttpParser (org.webpieces.httpparser.api.HttpParser)3 Http2Config (com.webpieces.http2engine.api.client.Http2Config)2 TimeImpl (com.webpieces.util.time.TimeImpl)2 Channel (org.webpieces.nio.api.channels.Channel)2 Provides (com.google.inject.Provides)1 Http2ServerEngineFactory (com.webpieces.http2engine.api.server.Http2ServerEngineFactory)1 TimerTask (java.util.TimerTask)1