Immutable Objects in Java Concurrent Programming

Immutable Objects Let's examine the date conversion problem first. @Slf4j(topic = "c.DateParseDemo") public class DateParseDemo { public static void main(String[] args) { runAnalysis(); } private static void runAnalysis() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); ...

Posted on Thu, 07 May 2026 13:45:29 +0000 by rptasiuk

Implementing Thread-Safe Counters in Java

In concurrent programmnig, a shared counter must be thread-safe to prevent data races and inconsistencies when accessed by multiple threads simultaneously. Two primary approaches to achieve this are using atomic variables and explicit synchronization via locks. Using AtomicInteger AtomicInteger provides atomic operations without requiring expli ...

Posted on Thu, 07 May 2026 13:32:40 +0000 by andrewgauger