use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class ServerAsync method createFrontend.
private HttpServer createFrontend() {
if (config.getServerThreadCount() != null) {
return createFrontendMultiThreaded();
}
log.info("Creating single threaded server");
TwoPools pool = new TwoPools("pl", new SimpleMeterRegistry());
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(metrics);
ChannelManager chanMgr = factory.createSingleThreadedChanMgr("svrCmLoop", pool, config.getBackpressureConfig());
AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(chanMgr, metrics);
HttpFrontendManager mgr = HttpFrontendFactory.createFrontEnd(svrMgr, pool, http2Config, new SimpleMeterRegistry());
return mgr.createHttpServer(new HttpSvrConfig("asyncsvr"), new EchoListener());
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class ServerAsync method createFrontendMultiThreaded.
private HttpServer createFrontendMultiThreaded() {
ScheduledExecutorService timer = Executors.newSingleThreadScheduledExecutor();
FrontendMgrConfig frontendConfig = new FrontendMgrConfig();
frontendConfig.setHttp2Config(http2Config);
frontendConfig.setBackpressureConfig(config.getBackpressureConfig());
frontendConfig.setThreadPoolSize(config.getServerThreadCount());
log.info("Creating multithreaded server. threads=" + frontendConfig.getThreadPoolSize());
HttpFrontendManager mgr = HttpFrontendFactory.createFrontEnd("deansvr", timer, new TwoPools("pl", new SimpleMeterRegistry()), frontendConfig, metrics);
return mgr.createHttpServer(new HttpSvrConfig("asyncsvr"), new EchoListener());
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class HttpFrontendFactory method createFrontEnd.
public static HttpFrontendManager createFrontEnd(ChannelManager chanMgr, ScheduledExecutorService timer, InjectionConfig injConfig, MeterRegistry metrics) {
TwoPools pool = new TwoPools(chanMgr.getName() + ".bufpoolmain", metrics);
HttpParser httpParser = HttpParserFactory.createParser(chanMgr.getName(), metrics, pool);
return createFrontEnd(chanMgr, timer, injConfig, httpParser, metrics);
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class IntegSingleRequest method createHttpClient.
public static Http2Socket createHttpClient(String id, boolean isHttp, InetSocketAddress addr) {
BufferPool pool2 = new TwoPools("pl", new SimpleMeterRegistry());
HpackParser hpackParser = HpackParserFactory.createParser(pool2, false);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory(Metrics.globalRegistry);
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, new BackpressureConfig(), executor2);
InjectionConfig injConfig = new InjectionConfig(hpackParser);
String host = addr.getHostName();
int port = addr.getPort();
ForTestSslClientEngineFactory ssl = new ForTestSslClientEngineFactory();
SSLEngine engine = ssl.createSslEngine(host, port);
Http2Client client = Http2ClientFactory.createHttpClient("myClient", mgr, injConfig);
Http2Socket socket;
if (isHttp) {
socket = client.createHttpSocket(new Http2CloseListener());
} else {
socket = client.createHttpsSocket(engine, new Http2CloseListener());
}
return socket;
}
use of org.webpieces.data.api.TwoPools in project webpieces by deanhiller.
the class TestCancelStream method setup.
@Before
public void setup() {
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
TwoPools pool = new TwoPools("client.bufferpool", metrics);
httpClient = Http2to11ClientFactory.createHttpClient("myClient2", mockChanMgr, new SimpleMeterRegistry(), pool);
mockChannel.setConnectFuture(XFuture.completedFuture(null));
mockChanMgr.addTCPChannelToReturn(mockChannel);
httpSocket = httpClient.createHttpSocket(new Http2CloseListener());
}
Aggregations