本项目包含Java单例模式的各种经典实现,包括饥饿式实现和懒汉式实现。从线程安全角度看,本项目又包括6种线程安全实现:
- 饿汉式
- 私有静态内部类式
- synchronized方法式
- synchronized块式
- 双重检查式
- ThreadLocal式
和1种非线程安全实现:
- 经典懒汉式。
此外,大家还可以参考我的博文《彻头彻尾理解单例模式与多线程》来深入了解单例模式的实现与原理。
Java单例模式及其多线程下的实现,包括六种线程安全实现和一种非线程安全实现(经典懒汉式)。
本项目包含Java单例模式的各种经典实现,包括饥饿式实现和懒汉式实现。从线程安全角度看,本项目又包括6种线程安全实现:
和1种非线程安全实现:
此外,大家还可以参考我的博文《彻头彻尾理解单例模式与多线程》来深入了解单例模式的实现与原理。
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.