[
https://issues.apache.org/jira/browse/LANG-501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oliver Heger updated LANG-501:
------------------------------
Attachment: BackgroundInitializer.patch
Thanks for the feedback.
Of course, {{setExternalExecutor()}} needs to be synchronized. I simply forgot
this. At the beginning I had this field final. But then I had the idea that
later a {{MultiBackgroundInitializer}} could be added that manages multiple
{{BackgroundInitializer}} objects and shares its {{ExecutorService}} between
them. For this use case the {{ExecutorService}} needs to be mutable.
I slightly modified the implementation to address your other points: The
package private methods are now only called from synchronized blocks, so there
is no need for them being synchronized. {{InitializationTask}} is passed a
reference to the {{ExecutorService}} it should destroy, so it need not access a
member field of the outer class any more.
> Add support for background initialization
> -----------------------------------------
>
> Key: LANG-501
> URL: https://issues.apache.org/jira/browse/LANG-501
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Oliver Heger
> Priority: Minor
> Fix For: 3.0
>
> Attachments: BackgroundInitializer.patch
>
>
> This is a suggestion to add a {{BackgroundInitializer}} class that allows
> initializing an object in a background task. {{BackgroundInitializer}} is a
> thin wrapper around a {{java.util.concurrent.Future}} object and uses an
> {{ExecutorService}} for starting a background task that performs
> initialization.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.