M4rk
M4rk

Reputation: 2272

HowTo start a thrift's TNonblockingServer in java?

I was testing Thrift on java, but this code give me some errors..

        ClientVoiceToTextHandler handler = new ClientVoiceToTextHandler();
        ClientVoiceToText.Processor<ClientVoiceToTextHandler> processor = new ClientVoiceToText.Processor<ClientVoiceToTextHandler>(handler);
        TServerTransport serverTransport = new TServerSocket(YSConfig.getInstance().ThriftPort);
        TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));

Errors on a client's connection:

    22:16:12.553 [pool-3-thread-5] ERROR o.a.thrift.server.TThreadPoolServer - Error occurred during processing of message.
java.lang.NullPointerException: null
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:176) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_01]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_01]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_01]

So I decided to pass to TNonblockingServer as I've done in my c++ app, but I don't know how

Upvotes: 2

Views: 2623

Answers (1)

Related Questions