Exemplo n.º 1
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();
  }
Exemplo n.º 2
0
 public SmartClientDaemon(SmartClientDaemonConfigurator configurator) {
   this.configurator = configurator;
   this.coord = configurator.getCoordinator();
   this.ringGroupName = configurator.getRingGroupName();
 }