You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Sangjin Lee (JIRA)" <ji...@apache.org> on 2008/03/17 19:02:26 UTC

[jira] Closed: (GERONIMO-3751) callbacks may not be completed when caller uses future.get() too to complete request handling

     [ https://issues.apache.org/jira/browse/GERONIMO-3751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sangjin Lee closed GERONIMO-3751.
---------------------------------


> callbacks may not be completed when caller uses future.get() too to complete request handling
> ---------------------------------------------------------------------------------------------
>
>                 Key: GERONIMO-3751
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3751
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: AsyncHttpClient
>    Affects Versions: 1.x
>            Reporter: Sangjin Lee
>            Priority: Minor
>         Attachments: GERONIMO-3751.patch
>
>
> Currently the callback methods from AsyncHttpClientCallback get called *after* the response future object is completed.  I think this causes a subtle bug that may prevent the callback methods from being completed if one uses both the callback and the future.
> For example, consider the following case:
> ResponseFuture future = client.invoke(..., callback); // callback is not null
> HttpResponseMessage response = future.get(); // this blocks until future is complete
> Since the future is completed before the callback is invoked, the caller thread in this case gets unblocked before the callback is called.  If the caller thread goes away, then there is possibility that the callback may not be completed or may not even be called, depending on the timing.
> This strikes me as a bug...  I propose we invoke the callback first and then complete the future so the callbacks are guaranteed to be completed even if future is used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.