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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CustomTHsHaServer.Factory`
    `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

    Constructors
    Constructor and Description
    `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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `joinSelector()` Block until the selector exits.
    `protected boolean` | `requestInvoke(org.apache.thrift.server.TNonblockingServer.FrameBuffer frameBuffer, CustomTHsHaServer.SelectorThread thread)`
    `protected void` | `requestSelectInterestChange(org.apache.thrift.server.TNonblockingServer.FrameBuffer fb)` A FrameBuffer wants to change its selection preferences, but might not be in the select thread.
    `void` | `serve()` Begin accepting connections and processing invocations.
    `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()

      Description copied from class: `org.apache.thrift.server.TNonblockingServer`
      Begin accepting connections and processing invocations.
      Overrides:
        `serve` in class `org.apache.thrift.server.TNonblockingServer`

    - #### startThreads

          protected boolean startThreads()

    - #### joinSelector

          protected void joinSelector()

      Description copied from class: `org.apache.thrift.server.TNonblockingServer`
      Block until the selector exits.
      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)

      Description copied from class: `org.apache.thrift.server.TNonblockingServer`
      A FrameBuffer wants to change its selection preferences, but might not be in the select thread.
      Overrides:
        `requestSelectInterestChange` in class `org.apache.thrift.server.TNonblockingServer`

Copyright © 2014 The Apache Software Foundation