You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2010/03/17 17:56:27 UTC

[jira] Commented: (LANG-609) Support lazy initialization using atomic variables

    [ https://issues.apache.org/jira/browse/LANG-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846469#action_12846469 ] 

Henri Yandell commented on LANG-609:
------------------------------------

Sounds good.

> Support lazy initialization using atomic variables
> --------------------------------------------------
>
>                 Key: LANG-609
>                 URL: https://issues.apache.org/jira/browse/LANG-609
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.concurrent.*
>            Reporter: Oliver Heger
>            Priority: Minor
>             Fix For: 3.0
>
>
> In the new concurrent package there is already the {{LazyInitializer}} class implementing the double-check idiom for lazy initialization of instance fields. Another way to perform initialization lazily would be the usage of atomic variables. This solution would not need synchronization at all. If there is low contention (not many threads in parallel), it is more efficient than synchronized access. Its drawback is that the initialization may be done multiple times if multiple threads access the initializer almost at the same time (however, it can be guaranteed that always the same object created by the initializer is returned).
> This is a proposal to add an {{AtomicInitializer}} class as an alternative to {{LazyInitializer}} that operates on {{AtomicReference}} variables.
> In order to make the initializers smoothly exchangable, it would make sense for them to share a common interface. This interface could also be implemented by the {{BackgroundInitializer}} class.

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