sjvanrossum commented on PR #39458: URL: https://github.com/apache/beam/pull/39458#issuecomment-5102091575
If I understand correctly, `open(String)` initializes all relevant fields which are thereafter never written to again, correct? Calling `open(String)` concurrently looks unsafe, so ideally it should be marked as `synchronized` along with `close()` to ensure mutually exclusive initialization after construction and to ensure visibility of those writes. Alternatively, attempt a CAS on `id` before writing any of the other fields for exclusive initialization after construction (note that visibility of the other fields is not yet guaranteed) followed by CAS on either `resourceId` or `channel` to establish a release barrier. That same field must be acquired (e.g., volatile get or `getAcquire`) before reading any other field in `close()`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
