use of org.glassfish.grizzly.nio.transport.TCPNIOTransport in project jersey by jersey.
the class JerseyGrizzlyRunner method main.
public static void main(String[] args) throws Exception {
System.out.println("Jersey performance test web service application");
final String jaxRsApp = args.length > 0 ? args[0] : null;
//noinspection unchecked
final ResourceConfig resourceConfig = ResourceConfig.forApplicationClass((Class<? extends Application>) Class.forName(jaxRsApp));
URI baseUri = args.length > 1 ? URI.create(args[1]) : BASE_URI;
int selectors = args.length > 2 ? Integer.parseInt(args[2]) : DEFAULT_SELECTORS;
int workers = args.length > 3 ? Integer.parseInt(args[3]) : DEFAULT_WORKERS;
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, resourceConfig, false);
final TCPNIOTransport transport = server.getListener("grizzly").getTransport();
transport.setSelectorRunnersCount(selectors);
transport.setWorkerThreadPoolConfig(ThreadPoolConfig.defaultConfig().setCorePoolSize(workers).setMaxPoolSize(workers));
server.start();
System.out.println(String.format("Application started.\nTry out %s\nHit Ctrl-C to stop it...", baseUri));
while (server.isStarted()) {
Thread.sleep(600000);
}
}
use of org.glassfish.grizzly.nio.transport.TCPNIOTransport in project Payara by payara.
the class GenericGrizzlyListener method configureTCPTransport.
protected NIOTransport configureTCPTransport(final Transport transportConfig) {
final TCPNIOTransport tcpTransport = configureDefaultThreadPoolConfigs(TCPNIOTransportBuilder.newInstance().build());
tcpTransport.setTcpNoDelay(Boolean.parseBoolean(transportConfig.getTcpNoDelay()));
tcpTransport.setLinger(Integer.parseInt(transportConfig.getLinger()));
tcpTransport.setWriteTimeout(Long.parseLong(transportConfig.getWriteTimeoutMillis()), TimeUnit.MILLISECONDS);
tcpTransport.setReadTimeout(Long.parseLong(transportConfig.getReadTimeoutMillis()), TimeUnit.MILLISECONDS);
tcpTransport.setServerConnectionBackLog(Integer.parseInt(transportConfig.getMaxConnectionsCount()));
return tcpTransport;
}
Aggregations