org.glassfish.grizzly.strategies.SameThreadIOStrategy Java Examples
The following examples show how to use
org.glassfish.grizzly.strategies.SameThreadIOStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GrizzlyClient.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override protected void doOpen() throws Throwable { FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), this)); filterChainBuilder.add(new GrizzlyHandler(getUrl(), this)); TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance(); ThreadPoolConfig config = builder.getWorkerThreadPoolConfig(); config.setPoolName(CLIENT_THREAD_POOL_NAME) .setQueueLimit(-1) .setCorePoolSize(0) .setMaxPoolSize(Integer.MAX_VALUE) .setKeepAliveTime(60L, TimeUnit.SECONDS); builder.setTcpNoDelay(true).setKeepAlive(true) .setConnectionTimeout(getConnectTimeout()) .setIOStrategy(SameThreadIOStrategy.getInstance()); transport = builder.build(); transport.setProcessor(filterChainBuilder.build()); transport.start(); }
Example #2
Source File: GrizzlyClient.java From dubbox with Apache License 2.0 | 6 votes |
@Override protected void doOpen() throws Throwable { FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), this)); filterChainBuilder.add(new GrizzlyHandler(getUrl(), this)); TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance(); ThreadPoolConfig config = builder.getWorkerThreadPoolConfig(); config.setPoolName(CLIENT_THREAD_POOL_NAME) .setQueueLimit(-1) .setCorePoolSize(0) .setMaxPoolSize(Integer.MAX_VALUE) .setKeepAliveTime(60L, TimeUnit.SECONDS); builder.setTcpNoDelay(true).setKeepAlive(true) .setConnectionTimeout(getTimeout()) .setIOStrategy(SameThreadIOStrategy.getInstance()); transport = builder.build(); transport.setProcessor(filterChainBuilder.build()); transport.start(); }
Example #3
Source File: GrizzlyClient.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Override protected void doOpen() throws Throwable { FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), this)); filterChainBuilder.add(new GrizzlyHandler(getUrl(), this)); TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance(); ThreadPoolConfig config = builder.getWorkerThreadPoolConfig(); config.setPoolName(CLIENT_THREAD_POOL_NAME) .setQueueLimit(-1) .setCorePoolSize(0) .setMaxPoolSize(Integer.MAX_VALUE) .setKeepAliveTime(60L, TimeUnit.SECONDS); builder.setTcpNoDelay(true).setKeepAlive(true) .setConnectionTimeout(getTimeout()) .setIOStrategy(SameThreadIOStrategy.getInstance()); transport = builder.build(); transport.setProcessor(filterChainBuilder.build()); transport.start(); }
Example #4
Source File: GrizzlyClient.java From dubbox with Apache License 2.0 | 6 votes |
@Override protected void doOpen() throws Throwable { FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), this)); filterChainBuilder.add(new GrizzlyHandler(getUrl(), this)); TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance(); ThreadPoolConfig config = builder.getWorkerThreadPoolConfig(); config.setPoolName(CLIENT_THREAD_POOL_NAME) .setQueueLimit(-1) .setCorePoolSize(0) .setMaxPoolSize(Integer.MAX_VALUE) .setKeepAliveTime(60L, TimeUnit.SECONDS); builder.setTcpNoDelay(true).setKeepAlive(true) .setConnectionTimeout(getTimeout()) .setIOStrategy(SameThreadIOStrategy.getInstance()); transport = builder.build(); transport.setProcessor(filterChainBuilder.build()); transport.start(); }
Example #5
Source File: Main.java From http-server-benchmarks with MIT License | 6 votes |
public static HttpServer startServer() { HttpServer server = new HttpServer(); server.addListener(new NetworkListener("grizzly", "0.0.0.0", 8080)); final TCPNIOTransportBuilder transportBuilder = TCPNIOTransportBuilder.newInstance(); //transportBuilder.setIOStrategy(WorkerThreadIOStrategy.getInstance()); transportBuilder.setIOStrategy(SameThreadIOStrategy.getInstance()); server.getListener("grizzly").setTransport(transportBuilder.build()); final ResourceConfig rc = new ResourceConfig().packages("xyz.muetsch.jersey"); rc.register(JacksonFeature.class); final ServerConfiguration config = server.getServerConfiguration(); config.addHttpHandler(RuntimeDelegate.getInstance().createEndpoint(rc, GrizzlyHttpContainer.class), "/rest/todo/"); try { server.start(); } catch (IOException e) { e.printStackTrace(); } return server; }
Example #6
Source File: GrizzlyClient.java From dubbox with Apache License 2.0 | 6 votes |
@Override protected void doOpen() throws Throwable { FilterChainBuilder filterChainBuilder = FilterChainBuilder.stateless(); filterChainBuilder.add(new TransportFilter()); filterChainBuilder.add(new GrizzlyCodecAdapter(getCodec(), getUrl(), this)); filterChainBuilder.add(new GrizzlyHandler(getUrl(), this)); TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance(); ThreadPoolConfig config = builder.getWorkerThreadPoolConfig(); config.setPoolName(CLIENT_THREAD_POOL_NAME) .setQueueLimit(-1) .setCorePoolSize(0) .setMaxPoolSize(Integer.MAX_VALUE) .setKeepAliveTime(60L, TimeUnit.SECONDS); builder.setTcpNoDelay(true).setKeepAlive(true) .setConnectionTimeout(getTimeout()) .setIOStrategy(SameThreadIOStrategy.getInstance()); transport = builder.build(); transport.setProcessor(filterChainBuilder.build()); transport.start(); }