public long nextUniqueTransaction ( long timeMs ) { long id = timeMs ; for ( ; ; ) { long old = transactionID . get ( ) ; if ( old >= id ) id = old + 1 ; if ( transactionID . compareAndSet ( old , id ) ) break ; } return id ; }
the transaction id are generated as unique timestamps