If the provided examples work, maybe the problem comes from your own code but we can't help you with very few information. I really advise you to try to reproduce your problem with a smaller code fragment and it would probably allow you to find the root cause or at least it would help us to understand what is wrong.
Edit.: try to use JVisualVM to know where it is locked.