Search in sources :

Example 11 with NamedThreadFactory

use of org.webpieces.util.threading.NamedThreadFactory 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

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