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(); } }
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(); } }
public void stopServer() { serverEngine.stop(); }
public void run() { serverEngine.serve(); }