Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Small issue with #2. There is no possible way for a deadlock with this class to occur. The class is entirely self contained. They only way there could be a deadlock is if a PrimeUtil instance relied on an another object that, in turn relied on that instance.