use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class ServerFactory method createTestServer.
static int createTestServer(boolean alwaysHttp2, Long maxConcurrentStreams) {
BufferCreationPool pool = new BufferCreationPool();
ScheduledExecutorService timer = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("webpieces-timer"));
HttpFrontendManager frontEndMgr = HttpFrontendFactory.createFrontEnd("frontEnd", 10, timer, pool);
FrontendConfig config = new FrontendConfig("id2", new InetSocketAddress(0));
HttpServer server = frontEndMgr.createHttpServer(config, new OurListener());
server.start();
return server.getUnderlyingChannel().getLocalAddress().getPort();
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class IntegTestEchoClientToOurServer method testSoTimeoutOnSocket.
public void testSoTimeoutOnSocket() throws InterruptedException {
EchoClient client = new EchoClient();
Executor executor = Executors.newFixedThreadPool(10, new NamedThreadFactory("serverThread"));
BufferPool pool = new BufferCreationPool();
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("server", pool, executor);
AsyncServerManager serverMgr = AsyncServerMgrFactory.createAsyncServer(mgr);
AsyncServer server = serverMgr.createTcpServer(new AsyncConfig("tcpServer"), new IntegTestLocalhostServerListener());
server.start(new InetSocketAddress(8080));
client.start(8080);
synchronized (this) {
this.wait();
}
}
use of org.webpieces.util.threading.NamedThreadFactory 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);
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class IntegGoogleHttps method createHttpClient.
public static HttpClient createHttpClient() {
BufferPool pool2 = new BufferCreationPool();
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, executor2);
HttpParser parser = HttpParserFactory.createParser(pool2);
HttpClient client = HttpClientFactory.createHttpClient(mgr, parser);
return client;
}
use of org.webpieces.util.threading.NamedThreadFactory 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);
}
Aggregations