View Javadoc

1   /*
2    * $Id: UUID.java 20746 2010-12-15 14:20:27Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.util;
12  
13  import org.safehaus.uuid.UUIDGenerator;
14  
15  /**
16   * <code>UUID</code> Generates a UUID using the <a href="http://jug.safehaus.org/">Safehaus UUID generator</a>
17   * rather than the built-in version of JDK5. In our performance tests we found the Java version
18   * to be blocking much more than the Safehaus one.
19   */
20  // @ThreadSafe
21  public final class UUID
22  {
23      private static final UUIDGenerator generator = UUIDGenerator.getInstance();
24  
25      private UUID()
26      {
27          // no go
28      }
29  
30      public static String getUUID()
31      {
32          return generator.generateTimeBasedUUID().toString();
33      }
34  }