Multi-threading simple application in Java