Change these to wait:
~~~
}).onComplete(f.wait());
~~~