make generation of SequenceNumber thread-safe so it is not possible to have two consecutive equal numbers generated