Thread Safety
- Stateless Implementation
- Source of error in most cases (multithreaded apps)
- Incorrectly sharing state between several threads
- Don't make your methods rely on external state, nor maintain any state at all
- Source of error in most cases (multithreaded apps)
- Immutable Implementation
- Need to share states between threads → make them immutable
- Immutable Class = Thread safe
- Synchronization
Backlinks