Fix Timed thread-safety. Fixes #12069

I've got similar to #12069 problem in my app. Here is a gist to reproduce (on jruby):  https://gist.github.com/etehtsea/7193889

If this really fixes the problem, I hope it will be backported to `4-0-stable` branch.