[JENKINS-20988] Deadlock

[JENKINS-20988](https://issues.jenkins-ci.org/browse/JENKINS-20988). Not sure how to reproduce the original deadlock, so did not try to confirm this fixes it, but since it avoids the apparently problematic code path it should.