Multihtreaded java application managing identical instances’ task