Tagged articles

thread-safety

228 articles · Page 3 of 3
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Oct 17, 2018 · Backend Development

Understanding CopyOnWriteArrayList in Java: Implementation, Principles, and Comparison with ArrayList

CopyOnWriteArrayList is a thread‑safe variant of ArrayList that achieves read‑write separation by copying the underlying array on each mutative operation, using a ReentrantLock for writes, making it ideal for read‑heavy, write‑light scenarios, and it differs from ArrayList in safety, performance, and concurrency behavior.

CopyOnWriteArrayListData StructuresJava
0 likes · 5 min read
Understanding CopyOnWriteArrayList in Java: Implementation, Principles, and Comparison with ArrayList
Java Captain
Java Captain
Sep 12, 2018 · Fundamentals

Understanding Processes, Threads, Multithreading, and Thread Safety in Java

This article explains the fundamentals of processes, threads, and multithreading in Java, illustrates common thread‑safety problems with example code, and demonstrates how to achieve safe concurrent execution using synchronized blocks and the Lock API, including tryLock with timeout.

JavaLockmultithreading
0 likes · 11 min read
Understanding Processes, Threads, Multithreading, and Thread Safety in Java
Xianyu Technology
Xianyu Technology
Aug 28, 2018 · Mobile Development

Understanding Flutter Platform Channel Working Principles

The article explains Flutter’s platform channels—BasicMessageChannel, MethodChannel, and EventChannel—detailing their components (name, messenger, codec), how messages are encoded, decoded, and routed via BinaryMessenger, the various codecs and handlers, and considerations for thread safety, large data transfer, and practical usage.

FlutterMobile DevelopmentPlatform Channel
0 likes · 14 min read
Understanding Flutter Platform Channel Working Principles
Programmer DD
Programmer DD
Jul 18, 2018 · Backend Development

How Does Java’s ConcurrentLinkedQueue Achieve Lock‑Free Thread Safety?

This article explains the lock‑free design of Java's ConcurrentLinkedQueue, detailing its core invariants, the internal Node structure, and step‑by‑step analyses of the offer and poll methods with code snippets and visual illustrations to demystify its CAS‑based concurrency mechanisms.

CASConcurrentLinkedQueueJava
0 likes · 13 min read
How Does Java’s ConcurrentLinkedQueue Achieve Lock‑Free Thread Safety?
Programmer DD
Programmer DD
Jun 21, 2018 · Fundamentals

Master Java Interview Essentials: 8 Classic Questions Explained

This article breaks down eight core Java interview questions, offering deep analysis of platform fundamentals, exception handling, reflection, I/O, concurrency, and object‑oriented design to help candidates demonstrate solid understanding beyond superficial answers.

Core ConceptsIOJava
0 likes · 12 min read
Master Java Interview Essentials: 8 Classic Questions Explained
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.

JavaMemory 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 LockingEnumJava
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 PersistenceMyBatisSpring Integration
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.

CASCopyOnWriteArrayListJava
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.

EnumJavaSingleton
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.

EnumJavaReflection
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
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.

AtomicityJavaVisibility
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.

MySQLSQLconcurrency
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.

ContextMobile DevelopmentObjective‑C
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.

JavaPerformanceSingleton
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.

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