added java version thread safe queue