Clock and UUID
Clock and UUID
tyrex.services.Clock provides an efficient mechanism for
obtaining the current system time. It uses a background thread to automatically
increment an internal clock and periodically synchronize with the system clock.
The method tyrex.services.Clock.clock() is more efficient than
java.lang.System.currentTimeMillis() and also allows the clock to be
artificially advanced for testing purposes.
tyrex.services.UUID is a Universally Unique Identifier (UUID)
generator. A UUID is an identifier that is unique across both space and time,
with respect to the space of all UUIDs. A UUID can be used for objects with
an extremely short lifetime, and to reliably identifying very persistent
objects across a network. UUIDs are 128 bit values and encoded as 36 character
identifiers.
This generator produces time-based UUIDs based on the varient specified in a
February 4, 1998 IETF draft. Identifiers can be created in string form with and
without a prefix, and as byte arrays. Convenience methods are also provided for
converting an identifier to and from an array of bytes.
tryex.services.DaemonMaster is responsible for starting,
terminating and restarting daemon thread. A daemon thread is a thread that
is kept live for the duration of the server's life and is only terminated
when the server is stopped. The daemon master protects the system from the
sudden and unexpected termination of daemons by automatically restarting them.
|