So, what you have is perfectly fine, but....

I actually have a Condition class in test.helpers that handles the condition loop for you.  I think you could replace your Object lock and most of the logic with it.