Tagged articles
221 articles
Page 3 of 3
Programmer DD
Programmer DD
Jun 2, 2018 · Fundamentals

Unlocking Java’s Happens‑Before: When Do Thread Changes Become Visible?

The article explains the Java Memory Model’s happens‑before principle, detailing its eight core rules, how they ensure visibility and ordering across threads, provides code examples, analyzes a non‑thread‑safe snippet, and shows how to achieve safety using locks or volatile variables.

Happens-beforeMemory Modelconcurrency
0 likes · 9 min read
Unlocking Java’s Happens‑Before: When Do Thread Changes Become Visible?
Java Backend Technology
Java Backend Technology
Apr 17, 2018 · Backend Development

Mastering the Singleton Pattern in Java: Eager, Lazy, and Thread‑Safe Implementations

This article explains the concept of design patterns and dives deep into the Singleton pattern in Java, covering its purpose, eager and lazy implementations, thread‑safety challenges, double‑checked locking, volatile usage, static inner class, and enum approaches, while illustrating each with clear code examples and diagrams.

Double-Check LockingSingletondesign pattern
0 likes · 11 min read
Mastering the Singleton Pattern in Java: Eager, Lazy, and Thread‑Safe Implementations
Java Backend Technology
Java Backend Technology
Mar 4, 2018 · Backend Development

Why is DefaultSqlSession Not Thread‑Safe and How Does SqlSessionTemplate Ensure Safety?

This article examines the thread‑unsafe nature of MyBatis's DefaultSqlSession, explains how SqlSessionTemplate and SqlSessionManager use proxy and ThreadLocal mechanisms to provide safe database access in Spring‑integrated environments, and presents related interview questions for deeper understanding.

Java PersistenceSpring IntegrationSqlSession
0 likes · 7 min read
Why is DefaultSqlSession Not Thread‑Safe and How Does SqlSessionTemplate Ensure Safety?
Java Captain
Java Captain
Feb 11, 2018 · Backend Development

Analyzing Java Concurrency Models: CopyOnWriteArrayList, ConcurrentHashMap, and LinkedBlockingQueue

This article examines three Java concurrency implementations—CopyOnWriteArrayList, ConcurrentHashMap, and LinkedBlockingQueue—explaining their underlying principles, code structures, and how they achieve thread‑safe read/write operations using techniques such as copy‑on‑write, CAS, and separate locks.

CASConcurrentHashMapCopyOnWriteArrayList
0 likes · 13 min read
Analyzing Java Concurrency Models: CopyOnWriteArrayList, ConcurrentHashMap, and LinkedBlockingQueue
Programmer DD
Programmer DD
Dec 6, 2017 · Fundamentals

Mastering Java Singleton: From Lazy Initialization to Enum with Thread‑Safety

This article walks through multiple Java Singleton implementations—lazy initialization, double‑checked locking, volatile‑protected, static‑inner‑class, and enum—explaining their thread‑safety characteristics, the pitfalls of instruction reordering, and how reflection and serialization can break or preserve the pattern.

Singletondesign patterndouble-checked locking
0 likes · 10 min read
Mastering Java Singleton: From Lazy Initialization to Enum with Thread‑Safety
Senior Brother's Insights
Senior Brother's Insights
Dec 4, 2017 · Fundamentals

Mastering Thread‑Safe Singleton in Java: Double‑Check, Static Holder, Enum & Reflection Hacks

Explore multiple Java singleton implementations—including a thread‑safe double‑checked locking version, a static inner‑class approach, an enum‑based solution, and a reflection‑based attack—while learning their key technical details, advantages, pitfalls, and how to protect against serialization and reflection vulnerabilities.

ReflectionSingletondesign pattern
0 likes · 6 min read
Mastering Thread‑Safe Singleton in Java: Double‑Check, Static Holder, Enum & Reflection Hacks
Java Captain
Java Captain
Nov 13, 2017 · Fundamentals

Understanding the Singleton Design Pattern in Java: Implementations, Thread Safety, and Best Practices

This article explains the Singleton design pattern in Java, covering its definition, lazy and eager implementations, thread‑safety issues such as double‑checked locking and volatile, and alternative approaches like static inner classes and enums, providing code examples and practical insights.

Singletondesign patterndouble-checked locking
0 likes · 14 min read
Understanding the Singleton Design Pattern in Java: Implementations, Thread Safety, and Best Practices
Tencent TDS Service
Tencent TDS Service
Mar 9, 2017 · Mobile Development

Mastering the Singleton Pattern in Android: Pitfalls, Best Practices, and Real‑World Implementations

This article explores the Singleton design pattern in depth, covering its definition, various Java implementations, thread‑safety concerns, serialization, reflection and cloning pitfalls, Android‑specific considerations, and practical recommendations for using singletons effectively in mobile projects.

Singletondesign patternenum
0 likes · 38 min read
Mastering the Singleton Pattern in Android: Pitfalls, Best Practices, and Real‑World Implementations
ZhiKe AI
ZhiKe AI
Feb 23, 2017 · Fundamentals

Why volatile Is Not Thread‑Safe: A Java Increment Test

The article presents a Java program where 100 threads each increment a volatile int 1,000 times, showing that the final value may be less than the expected 100,000, and explains that volatile only guarantees visibility, not atomicity, making it unsuitable for concurrent modifications.

atomicityconcurrencyjava
0 likes · 2 min read
Why volatile Is Not Thread‑Safe: A Java Increment Test
ITPUB
ITPUB
Oct 11, 2016 · Databases

How a Simple MySQL UPDATE Solved a Multi‑Threaded Counting Problem

A developer recounts how a seemingly trivial MySQL UPDATE statement—‘UPDATE table_name SET sum = sum + 5 WHERE id = 1’—proved thread‑safe for aggregating file counts across a multi‑threaded module, highlighting the importance of knowledge reserves and cautious evaluation before implementing complex synchronization solutions.

MySQLconcurrencydatabase
0 likes · 5 min read
How a Simple MySQL UPDATE Solved a Multi‑Threaded Counting Problem
Hujiang Technology
Hujiang Technology
May 27, 2016 · Mobile Development

Understanding Context Design in Objective‑C: Concepts, Nested Contexts, Thread Safety, and an Event Bus Example

This article explains the concept of a software context, discusses design considerations such as nesting and thread‑safety, and provides a concrete Objective‑C implementation including a lightweight event‑bus library, helping developers apply context patterns in mobile applications.

Mobile DevelopmentObjective‑Ccontext
0 likes · 8 min read
Understanding Context Design in Objective‑C: Concepts, Nested Contexts, Thread Safety, and an Event Bus Example
21CTO
21CTO
Mar 26, 2016 · Fundamentals

How a Custom Linux‑Based Distributed File System Achieves Scalability and Consistency

This article describes the design and implementation of a Linux‑based distributed file system (DFS) that targets large‑scale data storage and access, detailing its architecture, goals, storage model, consistency mechanisms, thread‑safety approach, synchronization strategies, and recovery processes to ensure high availability and data integrity.

DFS designDistributed File SystemLinux storage
0 likes · 35 min read
How a Custom Linux‑Based Distributed File System Achieves Scalability and Consistency
21CTO
21CTO
Mar 20, 2016 · Backend Development

Mastering Thread Safety in Java: When and How to Use synchronized

Thread safety issues arise when multiple threads access shared resources like variables, objects, or databases, potentially causing duplicate data or errors; this article explains when such problems occur and demonstrates how Java’s synchronized methods, synchronized blocks, and lock mechanisms can ensure safe, serialized access.

javamultithreadingsynchronized
0 likes · 12 min read
Mastering Thread Safety in Java: When and How to Use synchronized

Why the Singleton Pattern Matters: Lazy Loading, Thread Safety, and Real‑World Java Examples

This article explains the Singleton design pattern in Java, illustrates why a single instance is essential for configuration classes, compares eager and lazy initialization, shows thread‑safe implementations, and demonstrates extensions that limit the number of instances with practical code samples.

Singletondesign patternjava
0 likes · 12 min read
Why the Singleton Pattern Matters: Lazy Loading, Thread Safety, and Real‑World Java Examples
Qunar Tech Salon
Qunar Tech Salon
Feb 20, 2015 · Backend Development

Overview of How Web Servers Work and the Role of Java Servlets

This article explains the fundamentals of web servers, application servers, and web containers, describes the Java Servlet API—including Servlet, ServletContext, ServletRequest, ServletResponse, and session handling—and provides guidance on thread safety with illustrative code examples.

HTTPServletWeb server
0 likes · 11 min read
Overview of How Web Servers Work and the Role of Java Servlets