com.bigdata.journal
Class TimestampUtility

java.lang.Object
  extended by com.bigdata.journal.TimestampUtility

public class TimestampUtility
extends Object

Some static helper methods for timestamps.

Version:
$Id: TimestampUtility.java 4400 2011-04-15 00:33:29Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
TimestampUtility()
           
 
Method Summary
static long asHistoricalRead(long commitTime)
          Accepts a commitTime and returns a timestamp that will be interpreted as a historical read (this is a NOP).
static boolean isCommitTime(long timestamp)
          True iff the timestamp is a possible commit time (GT ZERO).
static boolean isReadCommitted(long timestamp)
           
static boolean isReadCommittedOrUnisolated(long timestamp)
           
static boolean isReadOnly(long timestamp)
          True iff the timestamp is a possible commit time (GT ZERO) -OR- a ITx.READ_COMMITTED request.
static boolean isReadWriteTx(long timestamp)
          Return true iff the timestamp is a possible read-write transaction identifier (LT ZERO).
static boolean isUnisolated(long timestamp)
           
static String toString(long timestamp)
          Formats the timestamp as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimestampUtility

public TimestampUtility()
Method Detail

toString

public static String toString(long timestamp)
Formats the timestamp as a String.

Parameters:
timestamp -
Returns:

isCommitTime

public static boolean isCommitTime(long timestamp)
True iff the timestamp is a possible commit time (GT ZERO).

Note: Both read-only transactions are commit times are positive. The transition identifier for a read-only transaction is chosen from among those distinct timestamps available between the effective commit time requested for the read-only transaction and the next commit time on the database.

Parameters:
timestamp - The timestamp.
Returns:
true for a possible commit time or a read-only tx.

isReadOnly

public static boolean isReadOnly(long timestamp)
True iff the timestamp is a possible commit time (GT ZERO) -OR- a ITx.READ_COMMITTED request.

Parameters:
timestamp - The timestamp.
Returns:
true for a possible commit time, a read-only tx, or a ITx.READ_COMMITTED request.

isReadWriteTx

public static boolean isReadWriteTx(long timestamp)
Return true iff the timestamp is a possible read-write transaction identifier (LT ZERO).

Parameters:
timestamp - The timestamp.
Returns:
true iff the timestamp is a possible read-write transaction identifier.

isReadCommittedOrUnisolated

public static boolean isReadCommittedOrUnisolated(long timestamp)

isReadCommitted

public static boolean isReadCommitted(long timestamp)

isUnisolated

public static boolean isUnisolated(long timestamp)

asHistoricalRead

public static long asHistoricalRead(long commitTime)
Accepts a commitTime and returns a timestamp that will be interpreted as a historical read (this is a NOP).

Parameters:
commitTime - The commit time from IIndexStore.getLastCommitTime(), etc.
Returns:
The corresponding timestamp that will be interpreted as a historical read against the state of the database having that commit time.
Throws:
IllegalArgumentException - if commitTime is negative (zero is permitted for some edge cases).


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