Mercurial > hg > Members > shoshi > TreeCMS > TreeCMSPrototype1
view src/treecms/proto/test/UUIDTest.java @ 13:3bccd745f2e2
bug fix
author | shoshi |
---|---|
date | Sun, 29 Aug 2010 12:07:03 +0900 |
parents | c8e31aaac297 |
children |
line wrap: on
line source
package treecms.proto.test; import java.util.*; public class UUIDTest extends Thread { public static void main(String _args[]) { Thread th1 = new UUIDTest(); Thread th2 = new UUIDTest(); Thread th3 = new UUIDTest(); Thread th4 = new UUIDTest(); th1.start(); th2.start(); th3.start(); th4.start(); try { th1.join(); th2.join(); th3.join(); th4.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static synchronized UUID getUUID() { return UUID.randomUUID(); } public void run() { for(int i = 0;i < 3;i ++){ try{ //System.out.println(UUID.randomUUID().toString()); System.out.println(UUIDTest.getUUID()); }catch(Exception _err){ _err.printStackTrace(); } } } }