use of org.apache.thrift.server.TSimpleServer in project HackTutorial by linrongbin16.
the class Server method main.
public static void main(String[] args) throws Exception {
ServerSocket socket = new ServerSocket(30003);
TServerSocket serverTransport = new TServerSocket(socket);
Basic.BasicService.Processor processor = new Basic.BasicService.Processor(new BasicServiceImpl());
TServer server = new TSimpleServer(new Args(serverTransport).processor(processor));
System.out.println("Server Starting...");
server.serve();
}
use of org.apache.thrift.server.TSimpleServer in project providence by morimekta.
the class RPCThriftSocketTest method setUp.
@Before
public void setUp() throws Exception {
Log.setLog(new NoLogging());
rc = copyResourceTo("/pvdrc", temp.getRoot());
copyResourceTo("/test.thrift", temp.getRoot());
impl = Mockito.mock(MyService.Iface.class);
TServerSocket transport = new TServerSocket(0);
server = new TSimpleServer(new TServer.Args(transport).protocolFactory(new TBinaryProtocol.Factory()).processor(new MyService.Processor<>(impl)));
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(server::serve);
Thread.sleep(1);
port = transport.getServerSocket().getLocalPort();
exitCode = 0;
rpc = new RPC(console.tty()) {
@Override
protected void exit(int i) {
exitCode = i;
}
};
}
use of org.apache.thrift.server.TSimpleServer in project vcell by virtualcell.
the class VCellProxyServer method startSimpleVCellProxyServer.
private static void startSimpleVCellProxyServer(VCellProxy.Processor<VCellProxyHandler> processor) {
try {
InetSocketAddress inetSocketAddress = new InetSocketAddress(InetAddress.getLoopbackAddress(), 9090);
TServerTransport serverTransport = new TServerSocket(inetSocketAddress);
TServer vcellProxyServer = new TSimpleServer(new org.apache.thrift.server.TServer.Args(serverTransport).processor(processor));
System.out.println("Starting the VCell-VisIt Data Server thread...");
vcellProxyServer.serve();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.apache.thrift.server.TSimpleServer in project tutorials by eugenp.
the class CrossPlatformServiceServer method start.
public void start() throws TTransportException {
TServerTransport serverTransport = new TServerSocket(9090);
server = new TSimpleServer(new TServer.Args(serverTransport).processor(new CrossPlatformService.Processor<>(new CrossPlatformServiceImpl())));
System.out.print("Starting the server... ");
server.serve();
System.out.println("done.");
}
use of org.apache.thrift.server.TSimpleServer in project commons by twitter.
the class PingPongServer method run.
@Override
public void run() {
PingPongHandler handler = new PingPongHandler();
PingPong.Processor processor = new PingPong.Processor(handler);
TServer server;
try {
TServerTransport transport = new TServerSocket(THRIFT_PORT.get());
server = new TSimpleServer(processor, transport);
} catch (TTransportException e) {
throw new RuntimeException(e);
}
LOG.info("Starting thrift server.");
server.serve();
}
Aggregations