Class BasicUUIDFactory
- java.lang.Object
-
- org.apache.derby.impl.services.uuid.BasicUUIDFactory
-
- All Implemented Interfaces:
UUIDFactory
public final class BasicUUIDFactory extends java.lang.Object implements UUIDFactory
A hack implementation of something similar to a DCE UUID generator. Generates unique 128-bit numbers based on the current machine's internet address, the current time, and a sequence number. This implementation should be made to conform to the DCE specification. ("DEC/HP, Network Computing Architecture, Remote Procedure Call Runtime Extensions Specification, version OSF TX1.0.11," Steven Miller, July 23, 1992. This is part of the OSF DCE Documentation. Chapter 10 describes the UUID generation algorithm.)Some known deficiencies:
- Rather than using the 48-bit hardware network address, it uses the 32-bit IP address. IP addresses are not guaranteed to be unique.
- There is no provision for generating a suitably unique number if no IP address is available.
- Two processes running on this machine which start their respective UUID services within a millisecond of one another may generate duplicate UUIDS.
However, the intention is that UUIDs generated from this class will be unique with respect to UUIDs generated by other DCE UUID generators.
-
-
Field Summary
Fields Modifier and Type Field Description private long
currentValue
private static long
INITIAL_VALUE
private long
majorId
private static long
MODULUS
private static long
MULTIPLIER
private static long
STEP
private long
timemillis
-
Constructor Summary
Constructors Constructor Description BasicUUIDFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
bumpMajor()
UUID
createUUID()
Generate a new UUID.private static ModuleFactory
getMonitor()
Privileged Monitor lookup.UUID
recreateUUID(java.lang.String uuidstring)
Recreate a UUID previously generated UUID value.private void
resetCounters()
-
-
-
Field Detail
-
majorId
private long majorId
-
timemillis
private long timemillis
-
MODULUS
private static final long MODULUS
- See Also:
- Constant Field Values
-
MULTIPLIER
private static final long MULTIPLIER
- See Also:
- Constant Field Values
-
STEP
private static final long STEP
- See Also:
- Constant Field Values
-
INITIAL_VALUE
private static final long INITIAL_VALUE
- See Also:
- Constant Field Values
-
currentValue
private long currentValue
-
-
Method Detail
-
createUUID
public UUID createUUID()
Generate a new UUID.- Specified by:
createUUID
in interfaceUUIDFactory
- Returns:
- The UUID.
- See Also:
UUIDFactory.createUUID()
-
recreateUUID
public UUID recreateUUID(java.lang.String uuidstring)
Recreate a UUID previously generated UUID value.- Specified by:
recreateUUID
in interfaceUUIDFactory
- Returns:
- The UUID.
- See Also:
UUIDFactory.recreateUUID(java.lang.String)
-
bumpMajor
private void bumpMajor()
-
resetCounters
private void resetCounters()
-
getMonitor
private static ModuleFactory getMonitor()
Privileged Monitor lookup. Must be private so that user code can't call this entry point.
-
-