synchronized public long generateId64() {
        long timestamp = System.currentTimeMillis();
        long sequence = 0;
        boolean done = false;
        while (!done) {
            done = true;
            while (timestamp < lastTimestampMillisec.get()) {
                timestamp = waitTillNextMillisec(timestamp);
            }
            if (timestamp == lastTimestampMillisec.get()) {
                // increase sequence
                sequence = sequenceMillisec.incrementAndGet();
                if (sequence > MAX_SEQUENCE_64) {
                    // reset sequence
                    sequenceMillisec.set(sequence = 0);
                    timestamp = waitTillNextMillisec(timestamp);
                    done = false;
                }
            }
        }
        sequenceMillisec.set(sequence);
        lastTimestampMillisec.set(timestamp);
        timestamp = (timestamp - TIMESTAMP_EPOCH) & MASK_TIMESTAMP_64;
        return timestamp << SHIFT_TIMESTAMP_64 | template64 | (sequence & MASK_SEQUENCE_64);
    }
synchronized public long generateId64 ( ) { long timestamp = System . currentTimeMillis ( ) ; long sequence = 0 ; boolean done = false ; while ( ! done ) { done = true ; while ( timestamp < lastTimestampMillisec . get ( ) ) { timestamp = waitTillNextMillisec ( timestamp ) ; } if ( timestamp == lastTimestampMillisec . get ( ) ) { sequence = sequenceMillisec . incrementAndGet ( ) ; if ( sequence > MAX_SEQUENCE_64 ) { sequenceMillisec . set ( sequence = 0 ) ; timestamp = waitTillNextMillisec ( timestamp ) ; done = false ; } } } sequenceMillisec . set ( sequence ) ; lastTimestampMillisec . set ( timestamp ) ; timestamp = ( timestamp - TIMESTAMP_EPOCH ) & MASK_TIMESTAMP_64 ; return timestamp << SHIFT_TIMESTAMP_64 | template64 | ( sequence & MASK_SEQUENCE_64 ) ; }
Generates a 64-bit id.

<p>
Format: {@code <41-bit:timestamp><10-bit:node-id><13-bit:sequence-number>}. Where
{@code timestamp} is in milliseconds, minus the epoch.
</p>

@return