Java Code Examples for org.apache.thrift.server.TServer#Args
The following examples show how to use
org.apache.thrift.server.TServer#Args .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DKSearchService.java From dk-fitting with Apache License 2.0 | 6 votes |
/** * * 简单的单线程模式 * */ public void startService(){ System.out.println( " start ...." ); //单接口声明 //TProcessor tProcessor=new DKSearchOutput.Processor<DKSearchOutput.Iface>( new DKSearchOutputImpl() ); //多接口声明 TMultiplexedProcessor processor = new TMultiplexedProcessor(); processor.registerProcessor( "DKSearchOutput",new DKSearchOutput.Processor<DKSearchOutput.Iface>( new DKSearchOutputImpl() ) ); processor.registerProcessor( "DKSearchInput",new DKSearchInput.Processor<DKSearchInput.Iface>(new DKSearchInputImpl() ) ); processor.registerProcessor( "DKSearchService",new SearchService.Processor<SearchService.Iface>(new SearchServiceImpl() ) ); try { TServerSocket serverSocket=new TServerSocket( Integer.valueOf(prop.get("dkSearch.port")) ); TServer.Args targs=new TServer.Args( serverSocket ); targs.processor( processor ); //二进制TBinaryProtocol //二进制高密度TCompactProtocol targs.protocolFactory( new TCompactProtocol.Factory( ) ); TServer tServer=new TSimpleServer( targs ); tServer.serve(); } catch (TTransportException e) { System.err.println("Service Start error"); e.printStackTrace(); } }
Example 2
Source File: ThriftServerApplication.java From spring-boot-demo with Apache License 2.0 | 6 votes |
public static void main(String[] args) { SpringApplication.run(ThriftServerApplication.class, args); try { System.out.println("服务端开启...."); TProcessor tprocessor = new Hello.Processor<Hello.Iface>(new HelloServiceImpl()); // 简单的单线程服务模型 TServerSocket serverTransport = new TServerSocket(9898); TServer.Args tArgs = new TServer.Args(serverTransport); tArgs.processor(tprocessor); tArgs.protocolFactory(new TBinaryProtocol.Factory()); TServer server = new TSimpleServer(tArgs); server.serve(); } catch (TTransportException e) { e.printStackTrace(); } }
Example 3
Source File: ThriftExample.java From pragmatic-java-engineer with GNU General Public License v3.0 | 5 votes |
public static void testRpcServer() throws TTransportException { TProcessor tprocessor = new TestService.Processor<TestService.Iface>(new TestServiceImpl()); TServerSocket serverTransport = new TServerSocket(8088); TServer.Args tArgs = new TServer.Args(serverTransport); tArgs.processor(tprocessor); tArgs.protocolFactory(new TBinaryProtocol.Factory()); // 简单的单线程服务模型 TServer server = new TSimpleServer(tArgs); server.serve(); }
Example 4
Source File: ServerArgsAspect.java From ikasoa with MIT License | 4 votes |
public TServer.Args tServerArgsAspect(TServer.Args args) { return args; }