You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/11/10 12:05:07 UTC
svn commit: r1033412 -
/james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java
Author: norman
Date: Wed Nov 10 11:05:07 2010
New Revision: 1033412
URL: http://svn.apache.org/viewvc?rev=1033412&view=rev
Log:
Allow to specify the IO-worker count (PROTOCOLS-8)
Modified:
james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java
Modified: james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java?rev=1033412&r1=1033411&r2=1033412&view=diff
==============================================================================
--- james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java (original)
+++ james/protocols/trunk/impl/src/main/java/org/apache/james/protocols/impl/AbstractAsyncServer.java Wed Nov 10 11:05:07 2010
@@ -48,6 +48,8 @@ public abstract class AbstractAsyncServe
private ChannelGroup channels = new DefaultChannelGroup();
+ private int ioWorker = Runtime.getRuntime().availableProcessors() * 2;
+
/**
* Set the ip on which the Server should listen on
@@ -71,6 +73,15 @@ public abstract class AbstractAsyncServe
}
/**
+ * Set the IO-worker thread count to use. Default is nCores * 2
+ *
+ * @param ioWorker
+ */
+ public void setIoWorkerCount(int ioWorker) {
+ if (started) throw new IllegalStateException("Can only be set when the server is not running");
+ this.ioWorker = ioWorker;
+ }
+ /**
* Start the server
*
* @throws Exception
@@ -81,7 +92,7 @@ public abstract class AbstractAsyncServe
if (port < 1) throw new RuntimeException("Please specify a port to which the server should get bound!");
- bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
+ bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool(), ioWorker));
ChannelPipelineFactory factory = createPipelineFactory(channels);
// Configure the pipeline factory.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org