[concurrency-interest] Why does FutureTask hold reference to the Callable object forever?

Kwok, Grace (MSCIBARRA) Grace.Kwok at mscibarra.com
Wed Jan 23 19:47:30 EST 2008

      After a FutureTask is run and result is set to a local variable
internally inside FutureTask, I would think that the Callable object
should not be needed anymore.   I would think that it would be best the
reference to the Callable object be set to null.
      Without nullifying the reference to the Callable object, it seems
to me that this can cause memory leak.  
      When implementing cache using the Memoizer pattern, the cache
becomes a map that not only holds strong references to the resulting
values, but also strong references to whatever that was needed for the
      Any thought on this?  A simple way to nullify the reference to the
callable inside FutureTask after "run" would be appreciated.
Thanks, Grace

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20080123/1acbd520/attachment.html 

More information about the Concurrency-interest mailing list