private TServer createPartitionServer(
     TNonblockingServerTransport transport, PartitionServer.Iface iface) {
   Args args = new Args(transport);
   args.processor(new PartitionServer.Processor(iface));
   args.protocolFactory(new TCompactProtocol.Factory());
   return new THsHaServer(args);
 }
Beispiel #2
0
  /**
   * start serving the thrift server. doesn't return.
   *
   * @throws IOException
   * @throws TException
   */
  private void serve() throws IOException, TException {
    // set up the service handler
    HankSmartClient handler;
    try {
      handler = new HankSmartClient(coord, ringGroupName);
    } catch (DataNotFoundException e) {
      throw new RuntimeException(e);
    }

    // launch the thrift server
    TNonblockingServerSocket serverSocket =
        new TNonblockingServerSocket(configurator.getPortNumber());
    Args options = new THsHaServer.Args(serverSocket);
    options.processor(new SmartClient.Processor(handler));
    options.workerThreads(configurator.getNumThreads());
    options.protocolFactory(new TCompactProtocol.Factory());
    server = new THsHaServer(options);
    server.serve();
  }