java-design-patterns icon indicating copy to clipboard operation
java-design-patterns copied to clipboard

fix: a concurrent problem for lazy initialization

Open light0x00 opened this issue 3 years ago • 1 comments

Pull request title

  • use atomic operation ConcurrentMap.computeIfAbsent instead of double-check-lock for lazy initialization

Pull request description

  • fix the concurrent problem

light0x00 avatar Mar 12 '22 06:03 light0x00

Hi! We are working on a tool that shows the "execution difference" of a patch. In other words, it reports if there has been a change in value of fields, local variables, or return. We tried to run our tool against the patch in this PR and got the following report (please open it a new tab to view it clearly):

Screenshot 2022-08-12 at 19-00-40 fix double lock check for lazy initialization · iluwatar_java-design-patterns@0e6045b

It would really help our research if the contributors could answer few of our questions.

  1. Does the execution difference assist you in investigating the cause of the build failure?
  2. Do you think it adds some more useful information that is not provided by the current state-of-the-art tools like Codecov, etc?

algomaster99 avatar Aug 12 '22 17:08 algomaster99

@light0x00 can you describe the problem that the pull request is fixing? I don't see any failures in the master branch tests.

iluwatar avatar Sep 25 '22 15:09 iluwatar

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 30 '22 23:10 stale[bot]

Closed due to inactivity

iluwatar avatar Nov 08 '22 19:11 iluwatar