« Return to Thread: async call issue
Consider the Lingo test case org.logicblaze.lingo.example.ExampleTest#testClient
Change the delay in ExampleServiceImpl.asyncRequestResponse(String stock, ResultListener listener) to 35 seconds.
public void testClient() throws Exception {
// START SNIPPET: simple
// lets lookup the client in Spring
// (we could be using DI here instead)
ExampleService service = (ExampleService) getBean("client");
// regular synchronous request-response
int i = service.regularRPC("Foo");
System.out.println("Found result: " + i);
// async request-response
TestResultListener listener = new TestResultListener();
service.asyncRequestResponse("IBM", listener);
//------------> sanjiv : new test code
int ret = service.regularRPC("foo");
System.out.println("return value is " + ret);
//------------> sanjiv : end new test code
// the server side will now invoke the listener
// objects's methods asynchronously
// END SNIPPET: simple
listener.waitForAsyncResponses(2);
System.out.println("Found results: " + listener.getResults());
}
In the example above, the async call is made (which runs for 35 seconds on the "server"). However when the next call of "ret = service.regularRPC("foo");" is made on the client, it blocks and eventually times out.
If we call an asynchronous call instead of service.regularRPC, that message is never received by the server.
« Return to Thread: async call issue
| Free embeddable forum powered by Nabble | Forum Help |