Single Threaded Task Handler in Java