You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2003/12/24 09:59:45 UTC
cvs commit: jakarta-commons-sandbox/uid/xdocs downloads.xml index.xml navigation.xml
psteitz 2003/12/24 00:59:45
Added: uid LICENSE.txt checkstyle.xml project.properties
project.xml
uid/src/java/org/apache/commons/uid/uuid UuidClock.java
uid/src/test/org/apache/commons/uid/uuid UuidClockTest.java
uid/xdocs downloads.xml index.xml navigation.xml
Log:
Initial project files.
Revision Changes Path
1.1 jakarta-commons-sandbox/uid/LICENSE.txt
Index: LICENSE.txt
===================================================================
/*
* $Source: /home/cvs/jakarta-commons-sandbox/uid/LICENSE.txt,v $
* $Revision: 1.1 $
* $Date: 2003/12/24 08:59:45 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation - http://www.apache.org/"
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* http://www.apache.org/
*
*/
1.1 jakarta-commons-sandbox/uid/checkstyle.xml
Index: checkstyle.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<!--
Checkstyle checks configured for Maven.
-->
<module name="Checker">
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
<module name="PackageHtml"/>
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- ************************************************************** -->
<!-- Checks that are different from the sun coding conventions ones -->
<!-- ************************************************************** -->
<module name="Header">
<property name="headerFile" value="${basedir}/LICENSE.txt"/>
<property name="ignoreLines" value="2,3,4,10"/>
</module>
<property name="tabWidth" value="4"/>
<module name="LeftCurly">
<property name="option" value="eol"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="LineLength">
<property name="max" value="132"/>
</module>
<module name="MethodLength">
<property name="max" value="175"/>
</module>
<!-- No Paren pad check
<module name="ParenPad"/>
-->
<module name="ConstantName">
<property name="format" value="log|^[a-zA-Z][a-zA-Z0-9_]*$"/>
</module>
<!-- ************************************************************** -->
<!-- Default Sun coding conventions checks -->
<!-- ************************************************************** -->
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="MemberName"/>
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="TabCharacter"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="NeedBraces"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows">
<property name="allowUnchecked" value="true"/> <!-- DISABLED -->
<property name="allowSubclasses" value="true"/> <!-- DISABLED -->
</module>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="DesignForExtension">
<property name="severity" value="ignore"/> <!-- DISABLED -->
</module>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="FinalParameters">
<property name="severity" value="ignore"/> <!-- DISABLED -->
</module>
<module name="GenericIllegalRegexp">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>
1.1 jakarta-commons-sandbox/uid/project.properties
Index: project.properties
===================================================================
maven.checkstyle.properties = checkstyle.xml
# uncomment the next line to work in offline mode (no jar download & no linkcheck)
#maven.mode.online=
maven.xdoc.poweredby.image=maven-feather.png
maven.javadoc.author=false
maven.javadoc.links=http://java.sun.com/products/jdk/1.4/docs/api
maven.xdoc.date=bottom
maven.xdoc.version=${pom.currentVersion}
maven.xdoc.developmentProcessUrl=http://jakarta.apache.org/commons/charter.html
maven.compile.debug=on
maven.compile.deprecation=off
maven.compile.optimize=off
maven.jarResources.basedir=src/java
maven.jar.excludes=**/package.html
maven.junit.fork=true
maven.junit.sysproperties=org.xml.sax.driver
org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
1.1 jakarta-commons-sandbox/uid/project.xml
Index: project.xml
===================================================================
<?xml version="1.0"?>
<project>
<extend>../../jakarta-commons/xdocs/maven/project-base.xml</extend>
<name>Commons Uid</name>
<id>commons-uid</id>
<logo>/images/compress-logo-blue.jpg</logo>
<url>http://jakarta.apache.org/commons/sandbox/uid/</url>
<inceptionYear>2003</inceptionYear>
<shortDescription>Commons Uid</shortDescription>
<description>
Commons Uid is a component used to generate unique identifiers.
</description>
<currentVersion>0.1-dev</currentVersion>
<versions>
</versions>
<branches>
</branches>
<developers>
<developer>
<name>Phil Steitz</name>
<id>psteitz</id>
<email>psteitz@apache.org</email>
<organization></organization>
<roles>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<contributors>
<contributor>
<name>Tim Reilly</name>
</contributor>
</contributors>
<dependencies>
<dependency>
<id>junit</id>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
<unitTest>
<includes>
<include>**/*Test*</include>
</includes>
</unitTest>
</build>
<reports>
<report>maven-changelog-plugin</report>
<report>maven-changes-plugin</report>
<report>maven-checkstyle-plugin</report>
<!-- <report>maven-clover-plugin</report> -->
<!-- <report>maven-developer-activity-plugin</report> -->
<!-- <report>maven-file-activity-plugin</report> -->
<report>maven-javadoc-plugin</report>
<!-- <report>maven-jellydoc-plugin</report> -->
<report>maven-junit-report-plugin</report>
<report>maven-jxr-plugin</report>
<report>maven-license-plugin</report>
<!-- <report>maven-linkcheck-plugin</report> -->
<!-- <report>maven-statcvs-plugin</report> -->
<report>maven-tasklist-plugin</report>
</reports>
</project>
1.1 jakarta-commons-sandbox/uid/src/java/org/apache/commons/uid/uuid/UuidClock.java
Index: UuidClock.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons-sandbox/uid/src/java/org/apache/commons/uid/uuid/UuidClock.java,v 1.1 2003/12/24 08:59:45 psteitz Exp $
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.uid.uuid;
/**
* UuidClock.java provides a timing mechanism for returning the current time in
* 100-nano second intervals since 00:00:00.00, 15 October 1582
*
* As described below this is useful for generating Version 1 UUIDs
*
* For more information regarding the IETF Draft Uuid specification
* see http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-01.txt
*
* Selected segements of Draft pertaining to this class:
*
* ====================================================================
* Timestamp
* The timestamp is a 60 bit value. For Uuid version 1, this is
* represented by Coordinated Universal Time (UTC) as a count of 100-
* nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of
* Gregorian reform to the Christian calendar).
*
* Clock Adjustment
* UUIDs may be created at a rate greater than the system clock resolution.
* Therefore, the system must also maintain an adjustment value to be added to
* the lower-order bits of the time. Logically, each time the system clock
* ticks, the adjustment value is cleared. Every time a UUID is generated,
* the current adjustment value is read and incremented atomically, then added
* to the UTC time field of the UUID.
*
* Clock Overrun
* The 100 nanosecond granularity of time should prove sufficient even for
* bursts of UUID creation in the next generation of high-performance
* multiprocessors. If a system overruns the clock adjustment by requesting
* too many UUIDs within a single system clock tick, the UUID service may
* raise an exception, handled in a system or process-dependent manner
* either by:
* terminating the request
* reissuing the request until it succeeds
* stalling the UUID generator until the system clock catches up.
*
* If the processors overrun the UUID generation frequently, additional node
* identifiers and clocks may need to be added.
* ====================================================================
*
* @version $Revision: 1.1 $ $Date: 2003/12/24 08:59:45 $
* @author Tim Reilly
*/
public class UuidClock extends Thread {
/** Default life of the UuidClock thread in milliseconds */
public static final long DEFAULT_THREAD_LIFE = 200;
/** Offset from GregorianCalendar Change over to Jan 1 1970 00:00:00.00 */
public static final long GREGORIAN_CHANGE_OFFSET = 12219292800000L;
/** Maximum ticks per millisecond interval */
public static final long TICKS_PER_MILLI = 10000L;
/** Life time of the clock thread in milliseconds */
private static long threadLife = DEFAULT_THREAD_LIFE;
/** Singleton instance of the UuidClock */
private static UuidClock clock = null;
/** The counter for nanoseconds generated during this system interval(ms) */
private int generatedThisMilli;
/** The current time in milliseconds held in this clock thread. */
private long currentTimeMillis;
/** Time when the clock thread should die */
private long expires = threadLife;
/**
* Private constructor for clock implementation. Utilizes a single thread to
* increment the clock every milli seconds this should be more
* accurate than System.currentTimeMillis() as described in
* the javaworld article:
* http://www.javaworld.com/javaworld/javaqa/2003-01/01-qa-0110-timing.html
*/
private UuidClock() {
setDaemon(true);
setPriority(Thread.MAX_PRIORITY);
currentTimeMillis = System.currentTimeMillis();
start();
}
/**
* Returns the thread life in milliseconds. If the clock thread is not
* accessed within this time span the thread will die off.
*
* @return thread life time span in milliseconds
*/
public static long getThreadLife() {
return UuidClock.threadLife;
}
/**
* @param threadLife milliseconds this thread should live for. Each
* call to getCurrentTime resets the expiration time value.
*/
public static void setThreadLife(long threadLife) {
UuidClock.threadLife = threadLife;
}
/**
* Threads run method that increments the clock and resets the generated
* nano seconds counter.
*/
public void run() {
try {
while (--expires >= 0) {
Thread.sleep(1);
currentTimeMillis++;
generatedThisMilli = 1;
}
} catch (InterruptedException e) {
System.out.println("UuidClock thread interrupted");
}
}
/**
* Returns the internal time milliseconds for the UuidClock instance
* @return the clock threads current time in milliseconds
*/
private long getCurrentTimeMillis() {
return currentTimeMillis;
}
/**
* Returns the current time as described in the clock resolution and
* timestamp sections of the uuid specification.
*
* @return the current time in 100-nano second intervals (simulated)
*/
private long currentTime() {
this.expires = threadLife;
// Stall until counter is reset to limit only 10000 intervals per
// millisecond interval
while (generatedThisMilli > TICKS_PER_MILLI) {
//wait for thread to reset
}
long currentTime =
((currentTimeMillis + GREGORIAN_CHANGE_OFFSET) * TICKS_PER_MILLI);
return currentTime + (generatedThisMilli++);
}
/**
* Static method returns the clocks current time in 100-nanosecond intervals
* since the Gregorian calander change. Calendar.GREGORIAN_OFFSET
*
* @return Coordinated Universal Time (UTC) as a count of 100- nanosecond
* intervals since 00:00:00.00, 15 October 1582
*/
public static synchronized long getCurrentTime() {
if (clock == null || !clock.isAlive()) {
clock = null;
clock = new UuidClock();
}
return clock.currentTime();
}
}
1.1 jakarta-commons-sandbox/uid/src/test/org/apache/commons/uid/uuid/UuidClockTest.java
Index: UuidClockTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.commons.uid.uuid;
import java.util.Arrays;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
/**
* Unit tests for {@link UuidClock}.
*
* @version $Revision: 1.1 $ $Date: 2003/12/24 08:59:45 $
* @author Phil Steitz
*/
public class UuidClockTest extends TestCase {
public UuidClockTest(String name) {
super(name);
}
public static void main(String[] args) {
TestRunner.run(suite());
}
public static Test suite() {
TestSuite suite = new TestSuite(UuidClockTest.class);
suite.setName("UUID Clock Tests");
return suite;
}
//-------------------------------------------------------------------------
protected void setUp() throws Exception {
super.setUp();
}
/**
* Make sure that time stamps generated by concurrent threads
* are unique.
*/
public void testUnique() throws Exception {
/*
* Number of timestamps to generate on each thread
*/
int iterations = 15000;
/*
* Number of client threads
*/
int threadCount = 4;
// Launch threadCount client threads and set them
// off generating time stamps
long[][] threadTimes = new long[threadCount][iterations];
Thread[] clockClients = new Thread[threadCount];
for (int i = 0; i < threadCount; i++) {
clockClients[i] = new ClockClient(threadTimes[i], iterations);
clockClients[i].start();
}
// Wait until all the threads are done
boolean working = true;
while (working) {
working = false;
for (int i = 0; i < threadCount; i++) {
if (clockClients[i].isAlive()) {
working = true;
}
}
}
// Gather up all of the times and test for uniqueness
long[] times = new long[iterations * threadCount];
int k = 0;
for (int i = 0; i < threadCount; i++) {
for (int j = 0; j < iterations; j++) {
times[k++] = threadTimes[i][j];
}
}
// Ridiculously inefficient, but effective -- sort and walk
Arrays.sort(times);
for (int i = 0; i < times.length - 1; i++) {
if (times[i] == times[i + 1]) {
fail("Duplicate time stamps generated: " + times[i] + " " + i);
}
}
}
/**
* Make sure that generated time stamps are within expected ranges.
* Need to look at this some more -- tolerance is now 10 seconds
*/
public void testRange() throws Exception {
long time = 0;
long baseTime = 0;
for (int i = 0; i < 10; i++) {
Thread.currentThread().sleep(10);
baseTime = System.currentTimeMillis();
for (int j = 0; j < 100; j++) {
time = UuidClock.getCurrentTime();
assertTrue("Generated timestamp too large",
time < ((baseTime + UuidClock.GREGORIAN_CHANGE_OFFSET + 10000) * UuidClock.TICKS_PER_MILLI));
assertTrue("Generated timestamp too small",
time > ((baseTime + UuidClock.GREGORIAN_CHANGE_OFFSET - 10000) * UuidClock.TICKS_PER_MILLI));
}
}
}
//--------------------------------------------------------------------------
/**
* UuidClock client thread
*/
protected static class ClockClient extends Thread {
/*
* Generated time stamps
*/
protected long[] times;
/*
* Number of time stamps to generate on this thread
*/
protected int iterations;
ClockClient(long[] times, int iterations) {
super();
this.times = times;
this.iterations = iterations;
}
public void run() {
for (int i = 0; i < iterations; i++) {
times[i] = UuidClock.getCurrentTime();
}
}
}
}
1.1 jakarta-commons-sandbox/uid/xdocs/downloads.xml
Index: downloads.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Downloads</title>
<author email="commons-dev@jakarta.apache.org">Commons Documentation Team</author>
<revision>$Id: downloads.xml,v 1.1 2003/12/24 08:59:45 psteitz Exp $</revision>
</properties>
<body>
<section name="Releases">
<p>There are no releases available.</p>
<!--
<p>The following releases are available:</p>
<ul>
<li>Version 1.1 - 20 October 2003</li>
<li>Version 1.0 - 12 August 2002</li>
</ul>
<br/>
<p>
The latest binary release is always available on the
<a href="http://jakarta.apache.org/site/binindex.cgi#commons-uid">
Jakarta Binary Downloads page</a>,
its source is available from
<a href="http://jakarta.apache.org/site/sourceindex.cgi#commons-uid">
Jakarta Source Downloads page</a>.
</p>
<p>
Older releases are retained by the Apache Software Foundation but are
moved into a
<a href="http://archive.apache.org/dist/jakarta/commons/uid/">
special archive area</a>.
</p>
<p>
<a href="http://cvs.apache.org/builds/jakarta-commons/nightly/commons-uid/">
Nightly source and binary drops</a> are also available.
</p>
-->
<p>
Access to the source tree to see the latest and greatest code is possible
through <a href="cvs-usage.html">anonymous CVS access</a>.
</p>
</section>
<!--
<section name="Release Candidate">
<p>
Release candidates for the upcoming 1.1 release can be downloaded
<a href="http://cvs.apache.org/~psteitz/builds/">here</a>.
</p>
<p>
Please review and report any problem on the
<a href="mail-lists.html">mailing list</a>.
</p>
<p>
Final release target is 20 October 2003.
</p>
</section>
-->
</body>
</document>
1.1 jakarta-commons-sandbox/uid/xdocs/index.xml
Index: index.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Overview</title>
<author email="commons-dev@jakarta.apache.org">Commons Documentation Team</author>
<revision>$Id: index.xml,v 1.1 2003/12/24 08:59:45 psteitz Exp $</revision>
</properties>
<body>
<section name="The Uid Component">
<p>Commons Uid is a component used to generate unique identifiers.</p>
<br/><br/>
</section>
<section name="Releases">
<p>
See the <a href="downloads.html">downloads</a> page for information on obtaining releases.
</p>
<br/><br/>
</section>
<section name="Documentation">
<p>
The <a href="apidocs/index.html">JavaDoc API documents</a> are available online.
</p>
</section>
</body>
</document>
1.1 jakarta-commons-sandbox/uid/xdocs/navigation.xml
Index: navigation.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE org.apache.commons.menus SYSTEM '../../../jakarta-commons/xdocs/stylesheets/menus/org-apache-commons-menus.dtd'>
<project name="Commons Uid">
<title>Commons Uid</title>
<body>
&top-menus;
<menu name="Commons Uid">
<item name="Overview" href="/index.html" />
<!-- <item name="Configuration" href="/configuration.html" /> -->
<item name="API Documentation" href="/apidocs/index.html"/>
<!--
<item name="Developers Guide" href="/guide/index.html" collapse="true">
<item name="Class Diagrams" href="/guide/classdiagrams.html"/>
<item name="Sequence Diagrams" href="/guide/sequencediagrams.html"/>
</item>
-->
<item name="Downloads" href="/downloads.html"/>
</menu>
&bottom-menus;
</body>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org