I just thought I'd add, the real issue with JRuby is that sleep doesn't always sleep for the required amount of time. Putting it in a loop is more reliable IMHO and removes the need for the fudge factor. Feel free to reimplement this logic however you see fit.