Thread safe linked list written in java