In general, we tend to synchronize the client access. If your application is sensitive to waiting, though, the client pool sounds like a reasonable idea. I think that would be something cool to have in Thrift language libraries, if we could figure out a general enough way to do it.

-Bryan

On May 22, 2009, at 7:05 AM, Oscar wrote:

Hi all,

In our project we need call RPCs in different threads.

//pseudo code

void init()
{
  //initialize the transport and protocol
}


void threadA()
{
//call rpc a using the initialized client
}

void threadB()
{
//call rpc b using the initialized client
}


The above code has the race-condition problem.

My question is: lock the client directly or make a client socket pool?

What's your opinion?

Reply via email to