[JENKINS-15820] Avoid deadlocks by using RentrantLock#tryLock() instead of synchronized

It's fix [JENKINS-15820](https://issues.jenkins-ci.org/browse/JENKINS-15820).