Hi there,
I want to call a Service and wait for a given time for a response. So I did a async servicecall like this: // Create mediator, to call service asynchronously IMyService mediated = asyncService.mediate(myService, IMyService.class); // Call service and await promise to be fulfilled Promise<Result> promise = asyncService.call(mediated.process()); boolean timeoutExceeded = false; long startTime = Calendar.getInstance().getTimeInMillis(); serviceTimeoutMillis = 100; // Wait until timeout for promise to be done while (!promise.isDone()) { Thread.sleep(10); if (Calendar.getInstance().getTimeInMillis() > startTime + serviceTimeoutMillis) { timeoutExceeded = true; break; } } if (timeoutExceeded) { throw new TimeoutException("Timeout exceeded"); } Now the question: is there a better way for waiting for promise-resolve until a given timeout? Maybe some feature of Async that i missed? Thanks in advance, Sebastian ---------------------------------------------------------------- Sebastian Lorr ITS Digital Solutions GmbH Dillenburger Str. 77 D-51105 Köln Tel.: +49 (0)221 820 07 0 Fax : +49 (0)221 820 07 22<tel:%2B49%20%280%29221%20820%2007%2022> Mail: i...@its-telco.de<mailto:i...@its-telco.de> Web : http://www.its-telco.de<http://www.its-telco.de/> ---------------------------------------------------------------- Sitz der Gesellschaft: Dortmund Amtsgericht Dortmund, HRB 28563 Geschäftsführer: Gunnar Haack, Ludger Schulte, Heinrich Toben, Raimund Schipp, Ralf Petersilka ---------------------------------------------------------------- Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. This e-mail may contain confidential information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.