Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.utils
Class SIDGenerator

java.lang.Object
  extended by org.nuxeo.ecm.core.utils.SIDGenerator

public final class SIDGenerator
extends Object

Generate session IDs.

Session IDs are long values that must be unique on the same JVM. Each call of the next() method returns an unique ID (unique relative to the current running JVM).

Author:
Bogdan Stefanescu

Method Summary
static long next()
          The long unique id is generated as follow:
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

next

public static long next()
The long unique id is generated as follow:

On the first 32 bits we put an integer value incremented at each call and that is reset to 0 when the it reaches the max integer range.

On the last 32 bits the most significant part of the current timestamp in milliseconds.

Returns:
the next unique id in this JVM

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.