com.bigdata.util
Class NanosecondTimestampFactory

java.lang.Object
  extended by com.bigdata.util.NanosecondTimestampFactory

public class NanosecondTimestampFactory
extends Object

Timestamp factory class with no more than nanosecond resolution - values produced by this class MUST NOT be persisted.

Note: There are several problems with System.nanoTime() to date and the values MUST NOT be persisted. The underlying problem is that the epoch MAY (and in practice does) change from VM instance to VM instance, often when the machine is rebooted. For this reason, nano time can appear to "go backward" rendering it unsuitable for placing timestamps on commit records. This means that we do not have access to time-based method with more than millisecond resolution of creating "distinctions" for transaction identifiers.

Note: Nano time could be made to work in a robust nano time service as long as the base time for the service is adjusted on service start or rollover to never go backward.

Version:
$Id: NanosecondTimestampFactory.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
NanosecondTimestampFactory()
           
 
Method Summary
static long nextNanoTime()
          Generates a timestamp with nanosecond precision that is guarenteed to be distinct from the last timestamp generated by this method within the same VM instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NanosecondTimestampFactory

public NanosecondTimestampFactory()
Method Detail

nextNanoTime

public static long nextNanoTime()
Generates a timestamp with nanosecond precision that is guarenteed to be distinct from the last timestamp generated by this method within the same VM instance.

Returns:
A timestamp with nanosecond precision that MUST NOT be persisted.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.