org.apache.cassandra.thrift
Class CustomTHsHaServer
java.lang.Object
org.apache.thrift.server.TServer
org.apache.thrift.server.TNonblockingServer
org.apache.cassandra.thrift.CustomTHsHaServer
public class CustomTHsHaServer
- extends org.apache.thrift.server.TNonblockingServer
This is a interim solution till THRIFT-1167 gets committed...
The idea here is to avoid sticking to one CPU for IO's. For better throughput
it is spread across multiple threads. Number of selector thread can be the
number of CPU available.
Nested classes/interfaces inherited from class org.apache.thrift.server.TNonblockingServer |
org.apache.thrift.server.TNonblockingServer.AbstractNonblockingServerArgs<T extends org.apache.thrift.server.TNonblockingServer.AbstractNonblockingServerArgs<T>>, org.apache.thrift.server.TNonblockingServer.Args, org.apache.thrift.server.TNonblockingServer.FrameBuffer, org.apache.thrift.server.TNonblockingServer.SelectThread |
Nested classes/interfaces inherited from class org.apache.thrift.server.TServer |
org.apache.thrift.server.TServer.AbstractServerArgs<T extends org.apache.thrift.server.TServer.AbstractServerArgs<T>> |
Fields inherited from class org.apache.thrift.server.TServer |
inputProtocolFactory_, inputTransportFactory_, outputProtocolFactory_, outputTransportFactory_, processorFactory_, serverTransport_ |
Constructor Summary |
CustomTHsHaServer(org.apache.thrift.server.TNonblockingServer.Args args,
java.util.concurrent.ExecutorService invoker,
int threadCount)
All the arguments to Non Blocking Server will apply here. |
Methods inherited from class org.apache.thrift.server.TNonblockingServer |
isStopped, requestInvoke, startListening, startSelectorThread, stopListening |
Methods inherited from class org.apache.thrift.server.TServer |
isServing, setServing |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CustomTHsHaServer
public CustomTHsHaServer(org.apache.thrift.server.TNonblockingServer.Args args,
java.util.concurrent.ExecutorService invoker,
int threadCount)
- All the arguments to Non Blocking Server will apply here. In addition,
executor pool will be responsible for creating the internal threads which
will process the data. threads for selection usually are equal to the
number of cpu's
serve
public void serve()
- Overrides:
serve
in class org.apache.thrift.server.TNonblockingServer
startThreads
protected boolean startThreads()
joinSelector
protected void joinSelector()
- Overrides:
joinSelector
in class org.apache.thrift.server.TNonblockingServer
stop
public void stop()
- Stop serving and shut everything down.
- Overrides:
stop
in class org.apache.thrift.server.TNonblockingServer
requestInvoke
protected boolean requestInvoke(org.apache.thrift.server.TNonblockingServer.FrameBuffer frameBuffer,
CustomTHsHaServer.SelectorThread thread)
requestSelectInterestChange
protected void requestSelectInterestChange(org.apache.thrift.server.TNonblockingServer.FrameBuffer fb)
- Overrides:
requestSelectInterestChange
in class org.apache.thrift.server.TNonblockingServer
Copyright © 2012 The Apache Software Foundation