Tagged articles
ThreadSafety
20 articles · Page 1 of 1
The article explains the CopyOnWrite (COW) concept, its read‑write separation benefits for thread‑safe, read‑heavy scenarios, key implementation details in Java’s CopyOnWriteArrayList—including volatile and transient usage—and discusses its memory overhead and eventual‑consistency drawbacks.
ConcurrencyCopyOnWriteDataStructure
0 likes · 5 min read

This article explores common pitfalls in Java date handling such as thread‑unsafe SimpleDateFormat and daylight‑saving issues, and presents robust solutions including ThreadLocal wrappers, Java 8 Date‑Time API, timezone‑aware calculations, caching strategies, and global interceptor designs to ensure safe, performant, and maintainable time processing.
DATETIMEJavaThreadSafety
0 likes · 10 min read

This article explains several Java date‑time pitfalls—including leap‑year calculations, differences between YYYY/yyyy and HH/hh patterns, SimpleDateFormat initialization, Calendar hour fields, integer overflow in date arithmetic, thread‑unsafe usage of SimpleDateFormat, and daylight‑saving‑time handling—providing code examples and best‑practice recommendations.
BackendDATETIMEDateFormatting
0 likes · 10 min read

This article explains several common Java singleton implementations—including lazy ("hungry"), eager, double‑checked locking, holder, and enum patterns—detailing their code, thread‑safety characteristics, performance trade‑offs, and pitfalls such as partial initialization and reflection attacks.
DesignPatternEnumJava
0 likes · 10 min read

Blocking queues are thread‑safe data structures in Java that support blocking operations, enabling producer‑consumer coordination; this article explains their definition, differences from List/Set and regular queues, various implementations such as ArrayBlockingQueue and LinkedBlockingQueue, core methods like take and put, and bounded versus unbounded capacities.
BlockingQueueConcurrencyDataStructure
0 likes · 11 min read

This article compares three common Java date‑time formatting approaches—SimpleDateFormat, Java 8’s DateTimeFormatter, and Apache Commons Lang3’s DateFormatUtils—examines thread‑safety issues, provides code examples, and offers conversion utilities between Date, LocalDate, and LocalDateTime for robust backend development.
Apache CommonsDATETIMEDateTimeFormatter
0 likes · 9 min read

This article explains the concepts, differences, and appropriate use cases of optimistic and pessimistic locks, exclusive and shared locks, mutex and read‑write locks, fair and unfair locks, reentrant, spin, segment locks, lock upgrades, and lock‑optimization techniques in Java concurrency programming.
LocksOptimisticLockPessimisticLock
0 likes · 13 min read

AtomicInteger provides a thread‑safe, lock‑free counter in Java by employing optimistic locking and CAS operations, offering higher efficiency than synchronized blocks; the article explains its motivation, usage examples, underlying Unsafe mechanisms, volatile semantics, and key methods such as incrementAndGet and compareAndSet.
CASJavaOptimisticLocking
0 likes · 7 min read

This article explains the copy‑on‑write optimization, compares Vector, Collections.synchronizedList and CopyOnWriteArrayList, analyzes their fail‑fast behavior, shows how CopyOnWriteArrayList is implemented and iterated, and presents performance benchmarks highlighting their strengths and weaknesses.
CopyOnWriteArrayListJavaThreadSafety
0 likes · 14 min read

This article explains the limitations of volatile for compound updates, demonstrates non‑thread‑safe bank‑account examples, introduces synchronized locking, and then shows how AtomicReference with CAS operations provides a lock‑free, thread‑safe solution, including a deep dive into its internal implementation and related memory‑barrier concepts.
AtomicReferenceCASConcurrency
0 likes · 14 min read

This article explains the internal structure of Java's HashMap, covering its array‑plus‑linked‑list‑plus‑red‑black‑tree implementation, hash function and collision resolution, the detailed put operation, resizing mechanics, and considerations for thread‑safe usage.
CollisionDataStructureHashFunction
0 likes · 10 min read

This article provides a comprehensive overview of Java concurrency, covering synchronized container classes, operating‑system level synchronization primitives, and the rich set of concurrent utilities introduced in the Java standard library, with code examples and explanations of fail‑fast and fail‑safe mechanisms.
ConcurrencyConcurrentUtilitiesJava
0 likes · 38 min read

This article provides an in‑depth explanation of Java's ArrayList, covering its purpose, lack of thread safety, detailed source‑code analysis of fields, constructors and core methods, serialization mechanics, capacity handling, and a simplified hand‑written implementation for interview preparation.
CodingInterviewDataStructureJava
0 likes · 13 min read

This article explains why the legacy Date and SimpleDateFormat classes are problematic, introduces Java 8's immutable LocalDate, LocalTime, LocalDateTime and Instant classes, demonstrates thread‑safe creation, formatting, parsing, modification and calculation, and shows practical SpringBoot integration examples.
APIDATETIMEJava
0 likes · 10 min read

This article explains the design and implementation of Java's LinkedBlockingDeque, covering its internal doubly‑linked list structure, key fields, constructors, core methods for adding, removing, and traversing elements, and provides a multithreaded example that demonstrates its thread‑safety compared to non‑concurrent collections.
ConcurrentQueueDataStructureJava
0 likes · 15 min read

This article provides a comprehensive overview of Java's LinkedBlockingQueue, covering its FIFO behavior, internal linked‑list structure, concurrency controls with separate put and take locks, detailed method implementations, and a multithreaded example demonstrating safe usage versus non‑thread‑safe alternatives.
BlockingQueueConcurrencyDataStructure
0 likes · 14 min read

This article explains the design, thread‑safety mechanisms, internal data structures, and core methods of Java's ArrayBlockingQueue, illustrating its creation, insertion, removal, and iteration with detailed code examples and a practical multithreaded demo.
ArrayBlockingQueueBlockingQueueConcurrency
0 likes · 13 min read

This article introduces Java's CopyOnWriteArrayList, explains its dynamic‑array and thread‑safety mechanisms, lists the most important methods, provides detailed source‑code walkthroughs for constructors, add, get, remove and iterator implementations, and demonstrates its behavior with a multithreaded example compared to ArrayList.
ConcurrencyCopyOnWriteArrayListJava
0 likes · 14 min read

This article explains why read‑write locks are needed, presents a simple Java implementation, and dives into the inner workings of ReentrantReadWriteLock, covering state encoding, acquisition and release algorithms, lock downgrading, and fairness policies.
AQSJavaLock
0 likes · 18 min read

This article explores Java high‑concurrency concepts, detailing the Java Memory Model, thread communication, instruction reordering, atomic classes, synchronization mechanisms, lock implementations, concurrent collections, and safe object publication, providing code examples and practical guidance for building robust multithreaded applications.
JMMJavaMultithreading
0 likes · 18 min read
