ehcache

net.sf.ehcache.util
Class Timestamper

java.lang.Object
  extended by net.sf.ehcache.util.Timestamper

public final class Timestamper
extends Object

Generates increasing identifiers (in a single VM only). Not valid across multiple VMs. Yet, the identifier is based on time, so that the drifting across a cluster should not ever be large...

Author:
Alex Snaps

Field Summary
static int BIN_DIGITS
          Value for left shifting System.currentTimeMillis, freeing some space for the counter
static int ONE_MS
          What is one milliseconds, based on "counter value reserved space", for this Timestamper
 
Method Summary
static long next()
          Returns an increasing unique value based on the System.currentTimeMillis() with some additional reserved space for a counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIN_DIGITS

public static final int BIN_DIGITS
Value for left shifting System.currentTimeMillis, freeing some space for the counter


ONE_MS

public static final int ONE_MS
What is one milliseconds, based on "counter value reserved space", for this Timestamper

Method Detail

next

public static long next()
Returns an increasing unique value based on the System.currentTimeMillis() with some additional reserved space for a counter.

Returns:
uniquely & increasing value
See Also:
BIN_DIGITS

ehcache

Copyright 2001-2014, Terracotta, Inc.