You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by melchizedec Sundararaj <me...@cloudinfra.in> on 2013/01/21 11:39:14 UTC

waiting for async calls to complete

Hi Thrift users,

I am invoking multiple async calls of thrift from my code. I would like to
wait for all of them to complete before going on with my next stage.

for (...) {
  TNonblockingTransport transport = new TNonblockingSocket(host, port);
  TAsyncClientManager clientManager = new TAsyncClientManager();
  TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
  AsyncClient c = new AsyncClient(protocolFactory, clientManager, transport);
  c.function(params, callback);

}

// I would like to wait for all the calls to be complete here.


One way is to have the callbacks keep decrementing an outstanding call
counter and signal.  Is there a better way to do this ?  I expected the
clientManager or the AsyncClient to have some way for me to wait till the
call completes.  but couldnt find one.

Any thoughts on how to do that would be really helpful.

Regards
Melchi