com.fasterxml.uuid.impl
Class TimeBasedGenerator

java.lang.Object
  extended by com.fasterxml.uuid.UUIDGenerator
      extended by com.fasterxml.uuid.NoArgGenerator
          extended by com.fasterxml.uuid.impl.TimeBasedGenerator

public class TimeBasedGenerator
extends NoArgGenerator

Implementation of UUID generator that uses time/location based generation method (variant 1).

As all JUG provided implementations, this generator is fully thread-safe. Additionally it can also be made externally synchronized with other instances (even ones running on other JVMs); to do this, use FileBasedTimestampSynchronizer (or equivalent).

Since:
3.0

Field Summary
protected  EthernetAddress _ethernetAddress
           
protected  UUIDTimer _timer
          Object used for synchronizing access to timestamps, to guarantee that timestamps produced by this generator are unique and monotonically increasings.
protected  long _uuidL2
          Base values for the second long (last 8 bytes) of UUID to construct
 
Constructor Summary
TimeBasedGenerator(EthernetAddress ethAddr, UUIDTimer timer)
           
 
Method Summary
 UUID generate()
           
 EthernetAddress getEthernetAddress()
           
 UUIDType getType()
          Accessor for determining type of UUIDs (variant) that this generator instance will produce.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ethernetAddress

protected final EthernetAddress _ethernetAddress

_timer

protected final UUIDTimer _timer
Object used for synchronizing access to timestamps, to guarantee that timestamps produced by this generator are unique and monotonically increasings. Some implementations offer even stronger guarantees, for example that same guarantee holds between instances running on different JVMs (or with native code).


_uuidL2

protected final long _uuidL2
Base values for the second long (last 8 bytes) of UUID to construct

Constructor Detail

TimeBasedGenerator

public TimeBasedGenerator(EthernetAddress ethAddr,
                          UUIDTimer timer)
Parameters:
addr - Hardware address (802.1) to use for generating spatially unique part of UUID. If system has more than one NIC,
Method Detail

getType

public UUIDType getType()
Description copied from class: UUIDGenerator
Accessor for determining type of UUIDs (variant) that this generator instance will produce.

Specified by:
getType in class UUIDGenerator

getEthernetAddress

public EthernetAddress getEthernetAddress()

generate

public UUID generate()
Specified by:
generate in class NoArgGenerator


Copyright © 2011 FasterXML.com. All Rights Reserved.