Search in sources :

Example 6 with HpackParser

use of com.webpieces.hpack.api.HpackParser in project webpieces by deanhiller.

the class HttpFrontendFactory method createFrontEnd.

/**
	 * 
	 * @param id Use for logging and also file recording names
	 * @param threadPoolSize The size of the threadpool, although all data comes in order as we
	 * use the SessionExecutorImpl found in webpieces
	 * 
	 * @return
	 */
public static HttpFrontendManager createFrontEnd(String id, int threadPoolSize, ScheduledExecutorService timer, BufferPool pool) {
    Executor executor = Executors.newFixedThreadPool(threadPoolSize, new NamedThreadFactory(id));
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
    ChannelManager chanMgr = factory.createMultiThreadedChanMgr(id, pool, executor);
    AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(chanMgr);
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, new TimeImpl(), new Http2Config());
    Http2ServerEngineFactory svrEngineFactory = new Http2ServerEngineFactory(injConfig);
    return new FrontEndServerManagerImpl(svrMgr, timer, svrEngineFactory, httpParser);
}
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) HttpParser(org.webpieces.httpparser.api.HttpParser) AsyncServerManager(org.webpieces.asyncserver.api.AsyncServerManager) Http2ServerEngineFactory(com.webpieces.http2engine.api.server.Http2ServerEngineFactory) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory) TimeImpl(com.webpieces.util.time.TimeImpl) FrontEndServerManagerImpl(org.webpieces.frontend2.impl.FrontEndServerManagerImpl)

Example 7 with HpackParser

use of com.webpieces.hpack.api.HpackParser 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)

Example 8 with HpackParser

use of com.webpieces.hpack.api.HpackParser in project webpieces by deanhiller.

the class Http2ClientFactory method createHttpClient.

public static Http2Client createHttpClient(Http2Config config, ChannelManager mgr, Executor executor, Time time) {
    BufferCreationPool pool = new BufferCreationPool();
    HpackParser hpackParser = HpackParserFactory.createParser(pool, false);
    InjectionConfig injConfig = new InjectionConfig(hpackParser, time, config);
    return createHttpClient(mgr, injConfig);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) BufferCreationPool(org.webpieces.data.api.BufferCreationPool)

Example 9 with HpackParser

use of com.webpieces.hpack.api.HpackParser in project webpieces by deanhiller.

the class WebServerModule method providesAsyncServerMgr.

@Provides
@Singleton
public HttpFrontendManager providesAsyncServerMgr(ChannelManager chanMgr, ScheduledExecutorService timer, @Named(HttpFrontendFactory.HTTP2_ENGINE_THREAD_POOL) Executor executor1, BufferPool pool, Time time, WebServerConfig config) {
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, time, config.getHttp2Config());
    return HttpFrontendFactory.createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) HttpParser(org.webpieces.httpparser.api.HttpParser) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Example 10 with HpackParser

use of com.webpieces.hpack.api.HpackParser in project webpieces by deanhiller.

the class HttpFrontendFactory method createFrontEnd.

public static HttpFrontendManager createFrontEnd(AsyncServerManager svrMgr, BufferPool pool, Http2Config http2Config, MeterRegistry metrics) {
    ScheduledExecutorService timer = Executors.newSingleThreadScheduledExecutor();
    HttpParser httpParser = HttpParserFactory.createParser(svrMgr.getName(), metrics, pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, new TimeImpl(), http2Config);
    Http2ServerEngineFactory svrEngineFactory = new Http2ServerEngineFactory(injConfig);
    return new FrontEndServerManagerImpl(svrMgr, timer, svrEngineFactory, httpParser);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) HttpParser(org.webpieces.httpparser.api.HttpParser) Http2ServerEngineFactory(com.webpieces.http2engine.api.server.Http2ServerEngineFactory) TimeImpl(org.webpieces.util.time.TimeImpl) FrontEndServerManagerImpl(org.webpieces.frontend2.impl.FrontEndServerManagerImpl)

Aggregations

HpackParser (com.webpieces.hpack.api.HpackParser)11 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)11 Executor (java.util.concurrent.Executor)6 ChannelManager (org.webpieces.nio.api.ChannelManager)6 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)6 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)6 HttpParser (org.webpieces.httpparser.api.HttpParser)5 TimeImpl (org.webpieces.util.time.TimeImpl)4 Http2ServerEngineFactory (com.webpieces.http2engine.api.server.Http2ServerEngineFactory)3 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)3 TwoPools (org.webpieces.data.api.TwoPools)3 FrontEndServerManagerImpl (org.webpieces.frontend2.impl.FrontEndServerManagerImpl)3 Provides (com.google.inject.Provides)2 Http2Config (com.webpieces.http2engine.api.client.Http2Config)2 TimeImpl (com.webpieces.util.time.TimeImpl)2 Singleton (javax.inject.Singleton)2 SSLEngine (javax.net.ssl.SSLEngine)2 AsyncServerManager (org.webpieces.asyncserver.api.AsyncServerManager)2 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)2 BufferPool (org.webpieces.data.api.BufferPool)2