Systems Engineering

WritingMedium

Understanding ThreadLocal vs Thread in Java

By Sachin Gupta10 min read
Portrait of Sachin Gupta rendered in binary

A Java concurrency note on when to reach for Thread versus ThreadLocal, how per-thread isolation avoids shared-state bugs like the classic SimpleDateFormat race, and how the two work together for thread-safe code.

Notes

A self-hosted write-up of this entry is on the way. In the meantime, the source link below has the canonical version, and the About page has context on the work I do day-to-day.

Related