Scala objects and thread safety

Viewed 8236

I am new to Scala.

I am trying to figure out how to ensure thread safety with functions in a Scala object (aka singleton)

From what I have read so far, it seems that I should keep visibility to function scope (or below) and use immutable variables wherever possible. However, I have not seen examples of where thread safety is violated, so I am not sure what other precautions should be taken.

Can someone point me to a good discussion of this issue, preferably with examples of where thread safety is violated?

3 Answers
Related