More control over Threading model of the server.
This commit is contained in:
@@ -7,13 +7,18 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
|
|||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.SynchronousQueue;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class LotroAsyncServer {
|
public class LotroAsyncServer {
|
||||||
public static void main(String[] server) {
|
public static void main(String[] server) {
|
||||||
ChannelFactory factory =
|
ChannelFactory factory =
|
||||||
new NioServerSocketChannelFactory(
|
new NioServerSocketChannelFactory(
|
||||||
Executors.newCachedThreadPool(),
|
Executors.newCachedThreadPool(),
|
||||||
Executors.newFixedThreadPool(10));
|
new ThreadPoolExecutor(10, Integer.MAX_VALUE,
|
||||||
|
60L, TimeUnit.SECONDS,
|
||||||
|
new SynchronousQueue<Runnable>()));
|
||||||
|
|
||||||
|
|
||||||
ServerBootstrap bootstrap = new ServerBootstrap(factory);
|
ServerBootstrap bootstrap = new ServerBootstrap(factory);
|
||||||
|
|||||||
Reference in New Issue
Block a user