On Wed, Nov 17, 2021 at 5:57 AM Ullrich Hafner <[email protected]> wrote:
> […] is stored in a CopyOnWriteArrayList. If your background thread > serializes my instance during the loop it can happen that the loop variable > is already set, but the list with the results is not. > Hard to follow what you are saying without a code reference, but a `CopyOnWriteArrayList` is designed to be safe to save from another thread; that is its whole purpose. I need some lock around the whole block of variables > Block of *fields*? Again hard to discuss without a concrete example, but in general if there is a block of data that should be replaced atomically, best to keep it all in its own object with `final` fields, and refer to that one object with a `volatile` field. -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0ouBxhg1arOFwosdrit-O9WdBeiiAbgSAA00%3DPnbBkPQ%40mail.gmail.com.
