Search in sources :

Example 1 with MultiServiceProcessor

use of org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor in project dubbo by alibaba.

the class AbstractTest method getProcessor.

protected TProcessor getProcessor() {
    MultiServiceProcessor result = new MultiServiceProcessor();
    result.addProcessor(org.apache.dubbo.rpc.gen.dubbo.Demo.class, new $__DemoStub.Processor(getServiceImpl()));
    return result;
}
Also used : MultiServiceProcessor(org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor) org.apache.dubbo.rpc.gen.dubbo.$__DemoStub(org.apache.dubbo.rpc.gen.dubbo.$__DemoStub)

Example 2 with MultiServiceProcessor

use of org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor in project dubbo by alibaba.

the class ServiceMethodNotFoundTest method init.

protected void init() throws Exception {
    TServerTransport serverTransport = new TServerSocket(PORT);
    DubboDemoImpl impl = new DubboDemoImpl();
    $__DemoStub.Processor processor = new $__DemoStub.Processor(impl);
    // for test
    Field field = processor.getClass().getSuperclass().getDeclaredField("processMap");
    ReflectUtils.makeAccessible(field);
    Object obj = field.get(processor);
    if (obj instanceof Map) {
        ((Map) obj).remove("echoString");
    }
    // ~
    TBinaryProtocol.Factory bFactory = new TBinaryProtocol.Factory();
    MultiServiceProcessor wrapper = new MultiServiceProcessor();
    wrapper.addProcessor(Demo.class, processor);
    server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).inputProtocolFactory(bFactory).outputProtocolFactory(bFactory).inputTransportFactory(getTransportFactory()).outputTransportFactory(getTransportFactory()).processor(wrapper));
    Thread startTread = new Thread() {

        @Override
        public void run() {
            server.serve();
        }
    };
    startTread.start();
    while (!server.isServing()) {
        Thread.sleep(100);
    }
}
Also used : MultiServiceProcessor(org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor) MultiServiceProcessor(org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor) TServerTransport(org.apache.thrift.transport.TServerTransport) org.apache.dubbo.rpc.gen.dubbo.$__DemoStub(org.apache.dubbo.rpc.gen.dubbo.$__DemoStub) TServerSocket(org.apache.thrift.transport.TServerSocket) Field(java.lang.reflect.Field) TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TThreadPoolServer(org.apache.thrift.server.TThreadPoolServer) Map(java.util.Map)

Aggregations

org.apache.dubbo.rpc.gen.dubbo.$__DemoStub (org.apache.dubbo.rpc.gen.dubbo.$__DemoStub)2 MultiServiceProcessor (org.apache.dubbo.rpc.protocol.thrift.ext.MultiServiceProcessor)2 Field (java.lang.reflect.Field)1 Map (java.util.Map)1 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)1 TThreadPoolServer (org.apache.thrift.server.TThreadPoolServer)1 TServerSocket (org.apache.thrift.transport.TServerSocket)1 TServerTransport (org.apache.thrift.transport.TServerTransport)1