[
https://issues.apache.org/jira/browse/LANG-501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12705830#action_12705830
]
Sebb commented on LANG-501:
---------------------------
Not sure why getExternalExecutor() is synchronized whereas
setExternalExecutor() is not.
Surely the set method should be synch., especially since the field is
documented as @GuardedBy("this") - as is future.
If the externalExecutor could be made final - e.g. by dropping the
setExternalExecutor() method - then the synch. would not be needed (assuming
ExecutorService is immutable).
The method fetchCurrentExecutor() fetches currentExecutor twice and writes it
once, but is not synchronized, and is not thread-safe.
InitializationTask.call() needs to synchronize the code in the finally clause
otherwise it may not see the correct value of externalExecutor.
> 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.