public static void startServer(Service.Processor<ServiceHandler> processor) {
    try {
      TServerTransport serverTransport = new TServerSocket(9090);
      TServer server = new TSimpleServer(new Args(serverTransport).processor(processor));

      // Use this for a multithreaded server
      // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));

      System.out.println("Starting the server...");
      server.serve();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Esempio n. 2
0
  public void run() {
    try {
      int port = 9090;
      TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(port);
      VicDataService.Processor<VicDataServiceImpl> processor =
          new VicDataService.Processor<VicDataServiceImpl>(new VicDataServiceImpl());

      TServer server =
          new TNonblockingServer(new TNonblockingServer.Args(serverTransport).processor(processor));
      System.out.println("Starting server on port " + port + " ...");

      server.serve();
    } catch (TTransportException e) {
      e.printStackTrace();
    }
  }
Esempio n. 3
0
 public void stopServer() {
   serverEngine.stop();
 }
Esempio n. 4
0
 public void run() {
   serverEngine.serve();
 }