Thrift Server. Java
package com.mts.dataops.virtualization;
import com.mts.dataops.datavirtualization.TrinoThriftService;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadPoolServer;
import org.apache.thrift.transport.TServerSocket;
import org.apache.thrift.transport.TServerTransport;
import org.apache.thrift.transport.TTransportException;
import org.apache.thrift.transport.layered.TFramedTransport;
public class Main {
public static void main(String[] args) throws TTransportException {
Server trino = new Server();
TrinoThriftService.Processor<Server> processor = new TrinoThriftService.Processor<>(trino);
TServerTransport serverTransport = new TServerSocket(9998);
TFramedTransport.Factory transportFactory = new TFramedTransport.Factory();
TBinaryProtocol.Factory protocolFactory = new TBinaryProtocol.Factory();
TThreadPoolServer.Args thriftArgs = new TThreadPoolServer.Args(serverTransport)
.processor(processor).
inputProtocolFactory(protocolFactory).
inputTransportFactory(transportFactory).
outputTransportFactory(transportFactory);
TServer server = new TThreadPoolServer(thriftArgs);
Thread thread = new Thread(server::serve);
thread.start();
}
}
Debug
ΠΠ»Ρ Java Π½Π΅Ρ Debug ΡΠ΅Π°Π»ΠΈΠ·Π°ΡΠΈΠΈ ΠΏΡΠΎΡΠΎΠΊΠΎΠ»ΠΎΠ².