title: Calling multiple asynchronous requests to Thrift Service from a single client
body: <p>For my Code it is necessary to call multiple asynchronous Requests from the same client to a Thrift Service. </p>
  
  <p>So I am using a Non blocking Server and Asynchronous Clients (see the code below) to allow asynchronous Calls, which means the execution of the code continues after the first call of the "checkForPrime()" Method, which I call on the Thrift Service.
  Now this seems to work with only executing one call. If I make a second asynchronous call right after, I get the following error message:</p>
  
  <pre><code>Client is currently executing another method: 
  Interfaces.PrimeCheck$AsyncClient$checkForPrime_call
      at 
  org.apache.thrift.async.TAsyncClient.checkReady(TAsyncClient.java:78)
      at 
  Interfaces.PrimeCheck$AsyncClient.checkForPrime(PrimeCheck.java:110)
      at ThriftClient.main(ThriftClient.java:40)
  </code></pre>
  
  <p>I need a smart solution to allow for multiple calls, but it has to be from the same client. Any suggestions are welcome. Please dont hesitate if you need further information.</p>
  
  <pre class="lang-java prettyprint-override"><code>        org.apache.thrift.protocol.TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory();
          TAsyncClientManager manager;
          TNonblockingSocket socket;
          AsyncClient client;
          try {
              manager = new TAsyncClientManager();
              socket =new TNonblockingSocket("localhost", 4711);
              client = new AsyncClient(factory, manager, socket);
              client.checkForPrime(5, resultHandler);
              client.checkForPrime(7, resultHandler);
              Thread.sleep(100);
          } catch (IOException e2) ....
  </code></pre>