How to handle asynchronous callbacks in a synchronous way in Java? How to handle asynchronous callbacks in a synchronous way in Java? multithreading multithreading