thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tuan Le Dinh <>
Subject How to make a Thrift client for multiple threads?
Date Tue, 07 Jun 2016 09:51:47 GMT

I have a working Thrift client in the below snippet.

TTransport transport = new THttpClient(new
Uri("http://localhost:8080/api/"));TProtocol protocol = new
TBinaryProtocol(transport);TMultiplexedProtocol mp = new
TMultiplexedProtocol(protocol, "UserService");UserService.Client
userServiceClient = new

When running the client within multi-threaded environment

threads[i] = new Thread(new Runnable() {
    public void run() {

I got an exception: *out of sequence response*

org.apache.thrift.TApplicationException: getUserById failed: out of
sequence response
at org.apache.thrift.TServiceClient.receiveBase(

I guess the reason is that Thrift generated Client is not thread safe. But
if I want multi-clients to call the same method getUserById() simultaneously,
how can I make it?

I made a copy of this question on Stackoverflow. You can see it here
Kind regards,
Tuan Le

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message