Updated Branches: refs/heads/trunk 559674593 -> 5dad16045
Swap THshaServer for TThreadedSelectorServer Patch by tjake; reviewed by jbellis for CASSANDRA-5530 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5dad1604 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5dad1604 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5dad1604 Branch: refs/heads/trunk Commit: 5dad16045eaa71240b4d190ee9166ef7b1db2788 Parents: 5596745 Author: Jake Luciani <j...@apache.org> Authored: Wed May 1 09:58:58 2013 -0400 Committer: Jake Luciani <j...@apache.org> Committed: Wed May 1 09:58:58 2013 -0400 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/thrift/CustomTHsHaServer.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dad1604/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 31054e3..f73349a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,6 +38,7 @@ * Add an official way to disable compactions (CASSANDRA-5074) * Reenable ALTER TABLE DROP with new semantics (CASSANDRA-3919) * Add binary protocol versioning (CASSANDRA-5436) + * Swap THshaServer for TThreadedSelectorServer (CASSANDRA-5530) 1.2.5 * fix compaction throttling bursty-ness (CASSANDRA-4316) http://git-wip-us.apache.org/repos/asf/cassandra/blob/5dad1604/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java index 557a5d8..411e082 100644 --- a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java +++ b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java @@ -22,6 +22,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; +import org.apache.thrift.server.TThreadedSelectorServer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,7 +42,7 @@ import org.apache.thrift.transport.TTransportException; * it is spread across multiple threads. Number of selector thread can be the * number of CPU available. */ -public class CustomTHsHaServer extends THsHaServer +public class CustomTHsHaServer extends TThreadedSelectorServer { private static final Logger LOGGER = LoggerFactory.getLogger(CustomTHsHaServer.class.getName()); @@ -89,11 +90,12 @@ public class CustomTHsHaServer extends THsHaServer TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new NamedThreadFactory("RPC-Thread"), "RPC-THREAD-POOL"); - THsHaServer.Args serverArgs = new THsHaServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory) + TThreadedSelectorServer.Args serverArgs = new TThreadedSelectorServer.Args(serverTransport).inputTransportFactory(args.inTransportFactory) .outputTransportFactory(args.outTransportFactory) .inputProtocolFactory(args.tProtocolFactory) .outputProtocolFactory(args.tProtocolFactory) .processor(args.processor) + .selectorThreads(Runtime.getRuntime().availableProcessors()) .executorService(executorService); // Check for available processors in the system which will be equal to the IO Threads. return new CustomTHsHaServer(serverArgs);