On Mon, 2009-11-16 at 17:39 -0500, Olivier Langlois wrote:
> Hi,
> 
> It seems to me that since the function oneway() and 
> futureResponse::getResponse() can throw exceptions, the code should make sure 
> that the requestMap is cleared in all cases. I would propose something like:
> 
> try
> {
>         // Send the request.
>         next->oneway( command );
> 
>         // Get the response.
>         response = futureResponse->getResponse( timeout );
> }
> catch(.)
> {
>         // Perform cleanup on the map.
>         synchronized( &mapMutex ){
> 
>             // We do not want memory corruption by accessing freed
>             // futureResponse objects by accident in onCommand() - get this 
> thing out
>             // of the map.
>             requestMap.erase( command->getCommandId() );
>         }
>        throw;
> }
> synchronized( &mapMutex ){
> 
>     // We've done our waiting - get this thing out
>     // of the map.
>     requestMap.erase( command->getCommandId() );
> }
> 
> Olivier Langlois
> C++ Technical Lead
> 
> STREAMTHEWORLD
> 
> t. 1 866 448 4037 ext. 675
> t. 1 514 448 4037 ext. 675
> f. 1 514 807 1861
> 
> olivier.langl...@streamtheworld.com
> streamtheworld.com
>  
> StreamTheWorld launches its new BlackBerry application. Learn more
> 

Your best bet is to open a new Jira issue to document the issue so that
it doesn't get lost on the mailing list.

Regards
Tim.


-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/



Reply via email to