public String nextStringIdentifier() {

        // Random value
        //--------------
        long currentRandom = randomizer.nextLong();
        if (currentRandom < 0) {
            currentRandom = -currentRandom;
        }
        // force value into 6 char range, and add to pad with zeros
        // this gives a length of 7, when converted to base 36, and
        // the first character (always 1 from the add) is dropped
        currentRandom %= MAX_RANDOM_LEN;
        currentRandom += MAX_RANDOM_LEN;

        long currentTimeValue = 0;
        int currentCount = 0;

        synchronized (this) {
            // Time
            //--------------
            currentTimeValue = (System.currentTimeMillis() / TIC_DIFFERENCE);

            // force value into 3 char range, and add to pad with zeros
            // this gives a length of 4, when converted to base 36, and
            // the first character (always 1 from the add) is dropped
            currentTimeValue %= MAX_TIME_SECTION_LEN;
            currentTimeValue += MAX_TIME_SECTION_LEN;

            // Count
            //--------------
            // Make the string unique by appending the count since last
            // time flip.

            // Count sessions only within tics (so the 'real' counter
            // isn't exposed to the public).
            if (lastTimeValue != currentTimeValue) {
                lastTimeValue = currentTimeValue;
                counter = 0;
            }
            currentCount = counter++;
        }

        // build string
        //--------------
        StringBuffer id = new StringBuffer
            (AbstractStringIdentifierGenerator.DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE);
        id.append(Long.toString(currentRandom,
            AbstractStringIdentifierGenerator.ALPHA_NUMERIC_CHARSET_SIZE).substring(1));  // 6 chars
        id.append(Long.toString(currentTimeValue,
            AbstractStringIdentifierGenerator.ALPHA_NUMERIC_CHARSET_SIZE).substring(1));  // 3 chars
        id.append(Long.toString(currentCount,
            AbstractStringIdentifierGenerator.ALPHA_NUMERIC_CHARSET_SIZE));  // 1+ chars
        return id.toString();
    }
public String nextStringIdentifier ( ) { long currentRandom = randomizer . nextLong ( ) ; if ( currentRandom < 0 ) { currentRandom = - currentRandom ; } currentRandom %= MAX_RANDOM_LEN ; currentRandom += MAX_RANDOM_LEN ; long currentTimeValue = 0 ; int currentCount = 0 ; synchronized ( this ) { currentTimeValue = ( System . currentTimeMillis ( ) / TIC_DIFFERENCE ) ; currentTimeValue %= MAX_TIME_SECTION_LEN ; currentTimeValue += MAX_TIME_SECTION_LEN ; if ( lastTimeValue != currentTimeValue ) { lastTimeValue = currentTimeValue ; counter = 0 ; } currentCount = counter ++ ; } StringBuffer id = new StringBuffer ( AbstractStringIdentifierGenerator . DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE ) ; id . append ( Long . toString ( currentRandom , AbstractStringIdentifierGenerator . ALPHA_NUMERIC_CHARSET_SIZE ) . substring ( 1 ) ) ; id . append ( Long . toString ( currentTimeValue , AbstractStringIdentifierGenerator . ALPHA_NUMERIC_CHARSET_SIZE ) . substring ( 1 ) ) ; id . append ( Long . toString ( currentCount , AbstractStringIdentifierGenerator . ALPHA_NUMERIC_CHARSET_SIZE ) ) ; return id . toString ( ) ; }
Gets the next new identifier.

<p>Only guaranteed unique within this JVM, but fairly safe
for cross JVM usage as well.</p>

<p>Format of identifier is
<code>[6 chars random][3 chars time][1+ chars count]</code></p>

@return the next 10 char String identifier