From: <one...@us...> - 2002-11-26 03:36:13
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/cache In directory sc8-pr-cvs1:/tmp/cvs-serv20166/cirrus/hibernate/cache Modified Files: Timestamper.java Log Message: fixed broken line-endings and added a test Index: Timestamper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/cache/Timestamper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Timestamper.java 7 Oct 2002 07:39:38 -0000 1.2 --- Timestamper.java 26 Nov 2002 03:35:40 -0000 1.3 *************** *** 1,26 **** ! //$Id$ ! package cirrus.hibernate.cache; ! ! /** ! * Generates increasing identifiers (in a single VM only). ! * Not valid across multiple VMs. Identifiers are not necessarily ! * strictly increasing, but usually are. ! */ ! public class Timestamper { ! private static short counter = 0; ! private static long time; ! ! public synchronized static long next() { ! ! long newTime = System.currentTimeMillis() << 16; ! if (time<newTime) { ! time = newTime; ! counter = 0; ! } ! else if (counter<Short.MAX_VALUE) { ! counter++; ! } ! ! return time + counter; ! } ! } --- 1,26 ---- ! //$Id$ ! package cirrus.hibernate.cache; ! ! /** ! * Generates increasing identifiers (in a single VM only). ! * Not valid across multiple VMs. Identifiers are not necessarily ! * strictly increasing, but usually are. ! */ ! public class Timestamper { ! private static short counter = 0; ! private static long time; ! ! public synchronized static long next() { ! ! long newTime = System.currentTimeMillis() << 16; ! if (time<newTime) { ! time = newTime; ! counter = 0; ! } ! else if (counter<Short.MAX_VALUE) { ! counter++; ! } ! ! return time + counter; ! } ! } |