| java.lang.Object org.drools.util.UUIDGenerator
UUIDGenerator | final public class UUIDGenerator (Code) | | Ripped from JUG
See Also: org.safehaus.jug |
generateRandomBasedUUID | public UUID generateRandomBasedUUID()(Code) | | Method for generating (pseudo-)random based UUIDs, using the
default (shared) SecureRandom object.
Note that the first time
SecureRandom object is used, there is noticeable delay between
calling the method and getting the reply. This is because SecureRandom
has to initialize itself to reasonably random state. Thus, if you
want to lessen delay, it may be be a good idea to either get the
first random UUID asynchronously from a separate thread, or to
use the other generateRandomBasedUUID passing a previously initialized
SecureRandom instance.
UUID generated using (pseudo-)random based method |
generateRandomBasedUUID | public UUID generateRandomBasedUUID(Random randomGenerator)(Code) | | Method for generating (pseudo-)random based UUIDs, using the
specified SecureRandom object. To prevent/avoid delay JDK's
default SecureRandom object causes when first random number
is generated, it may be a good idea to initialize the SecureRandom
instance (on a separate thread for example) when app starts.
Parameters: randomGenerator - Random number generator to use for getting therandom number from which UUID will be composed. UUID generated using (pseudo-)random based method |
getInstance | public static UUIDGenerator getInstance()(Code) | | Method used for accessing the singleton generator instance.
|
getRandomNumberGenerator | public Random getRandomNumberGenerator()(Code) | | Method for getting the shared random number generator used for
generating the UUIDs. This way the initialization cost is only
taken once; access need not be synchronized (or in cases where
it has to, SecureRandom takes care of it); it might even be good
for getting really 'random' stuff to get shared access...
|
setRandomNumberGenerator | public void setRandomNumberGenerator(Random r)(Code) | | Method that can be called to specify alternative random
number generator to use. This is usually done to use
implementation that is faster than
SecureRandom that is used by default.
Note that to avoid first-time initialization penalty
of using
SecureRandom , this method has to be called
before generating the first random-number based UUID.
|
|
|