LPS-50484 Use a thread-safe alternative in place of java.util.HashSet

CC @laszlocsontos

Brian, this is an incomplete fix, but still better than not fixing it at all.

I will provide a complete fix when I come back from paternity leave.