## 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 Class Summary
`protected class` `CustomTHsHaServer.Invocation` Save the remote socket as a thead local for future use of client state.
`protected class` `CustomTHsHaServer.SelectorThread` IO Threads will perform expensive IO operations...

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>>`

Field Summary

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.

Method Summary
`protected void` `joinSelector()`
`protected boolean` `requestInvoke(org.apache.thrift.server.TNonblockingServer.FrameBuffer frameBuffer, CustomTHsHaServer.SelectorThread thread)`
`protected void` `requestSelectInterestChange(org.apache.thrift.server.TNonblockingServer.FrameBuffer fb)`
`void` `serve()`
`protected boolean` `startThreads()`
`void` `stop()` Stop serving and shut everything down.

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`

Constructor Detail

### 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

Method Detail

### 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