use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class WebServerModule method providesChanMgr.
@Provides
@Singleton
public ChannelManager providesChanMgr(WebServerConfig config, BufferPool pool) {
String id = "webpieces";
Executor executor = Executors.newFixedThreadPool(config.getNumFrontendServerThreads(), new NamedThreadFactory(id));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager chanMgr = factory.createMultiThreadedChanMgr(id, pool, executor);
return chanMgr;
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class IntegSingleRequest method createHttpClient.
public static Http2Socket createHttpClient(String id, boolean isHttp, InetSocketAddress addr) {
BufferPool pool2 = new BufferCreationPool();
HpackParser hpackParser = HpackParserFactory.createParser(pool2, false);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, 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(mgr, injConfig);
Http2Socket socket;
if (isHttp) {
socket = client.createHttpSocket(id);
} else {
socket = client.createHttpsSocket(id, engine);
}
return socket;
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class IntegTestLocalhostThroughput method testSoTimeoutOnSocket.
public void testSoTimeoutOnSocket() throws InterruptedException {
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));
BufferPool pool2 = new BufferCreationPool();
DataListener listener = new ClientDataListener(pool2, recorder);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
TCPChannel channel = createClientChannel(pool2, executor2);
//TCPChannel channel = createNettyChannel();
recorder.start();
CompletableFuture<Channel> connect = channel.connect(new InetSocketAddress(8080), listener);
connect.thenAccept(p -> runWriting(channel));
synchronized (this) {
this.wait();
}
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class IntegTestClientToEchoServer method testSoTimeoutOnSocket.
public void testSoTimeoutOnSocket() throws InterruptedException {
runEchoServer();
BufferPool pool2 = new BufferCreationPool();
DataListener listener = new ClientDataListener(pool2, recorder);
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
TCPChannel channel = createClientChannel(pool2, executor2);
//TCPChannel channel = createNettyChannel();
recorder.start();
CompletableFuture<Channel> connect = channel.connect(new InetSocketAddress(4444), listener);
connect.thenAccept(p -> runWriting(channel));
synchronized (this) {
this.wait();
}
}
use of org.webpieces.util.threading.NamedThreadFactory in project webpieces by deanhiller.
the class TestBasicSsl method createSvrChanMgr.
private ChannelManager createSvrChanMgr(String name) {
ExecutorService executor = Executors.newFixedThreadPool(10, new NamedThreadFactory(name));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager svrMgr = factory.createMultiThreadedChanMgr(name + "Mgr", new BufferCreationPool(), executor);
return svrMgr;
}
Aggregations