Giter Club home page Giter Club logo

Comments (1)

clay-mayers avatar clay-mayers commented on July 18, 2024

The above looks like you've quoted this article: https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html.

I don't see an issue here. This is my understanding. The idiom used there is not the same as what is used by Hollow. The article is about "just-in-time" construction of a member object being read without "synchronization" (i.e., barrier or lock of some sort). The Hollow code is constructing an object read from a ConcurrentHashMap, which is "synchronized" (not by the keyword necessarily but by the use of a barrier or lock). An update has a happens-before relation with get so all writes before the update (i.e. the construction of schema) will be visible to whoever called get.

What's inside the synchronized block is only there to construct a single schema. If that were not there, the only consequence would be two constructed schema's instead of one, not a data inconsistency issue.

Looking past the "double-checked" idiom critique, underneath is the general issue of making a constructed object visible to multiple threads before the writes of that object are fully visible. This applies to discoveredSchemas, but that already has the "additional synchronization" because it is declared final. That ensures all threads see the fully constructed Map<>.

I think this a correct analysis - if not, please be more specific on what the issue is.

from hollow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.