On Friday, June 03, 2011 10:06:39 AM David L wrote:
> Hi all,
> 
> What is the best practice for handling async call response?
> Below is what I do normally,
> 
> new AsyncHandler<MyResponse>() {
>     @Override
>     public void handleResponse(Response<MyResponse> res) {
>         try {
>             MyResponse v = res.get();
>             // process v ...
>         }catch (Exception e) {
>             // log the exception
>         }
>     }
> }
> 
> Do I need to check isCancelled() or isDone() before I call get()?

No.  Those are both checked internally.  (well, get will wait until isDone 
would be true and then return the result).


> If the web service method is of type void, do I still need to call get()?
> If I don't call get(), will I miss out any errors?

You would, yes.   The exceptions are only thrown from the get call.

Dan


> For example, exceptions are only thrown when get() is called.
> 
> Best regards,
> 
> David

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to