nnym / dycon Goto Github PK
View Code? Open in Web Editor NEW`ldc` intrinsics for lazy dynamic constants inspired by JEP 303
License: Other
`ldc` intrinsics for lazy dynamic constants inspired by JEP 303
License: Other
Note that dynamic constants do not have exclusive initialization like classes do (to draw a parallel to the lazy-holder pattern example). This means that each time a thread encounters an uninitialized dynamic constant, the bootstrap for it is invoked from that thread, which in turn means that the bootstrap may be concurrently invoked. This is especially significant if the initialization is expensive. In this case, the user would need to introduce their own locking strategy.
For more information, see section 5.4.3.6 of the JVM specification, particularly this passage at the bottom of the section:
If several threads attempt resolution of R at the same time, the bootstrap method may be invoked concurrently. Therefore, bootstrap methods which access global application data must take precautions against race conditions.
Also of interest in that section is:
Unlike class initialization (§5.5), where cycles are allowed between uninitialized classes, resolution does not allow cycles in symbolic references to dynamically-computed constants. If an implementation of resolution makes recursive use of a stack, then a StackOverflowError will occur naturally. If not, the implementation is required to detect the cycle rather than, say, looping infinitely or returning a default value for the dynamically-computed constant.
If you put those two things together, it adds up to potential deadlock if user locking is used and there is a cycle in constant initialization.
The documentation should probably be updated to reflect this.
An IntelliJ plugin for highlighting errors might be useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.