JAVA GUID

import java.util.UUID; 
import java.util.concurrent.ExecutorService; 
import java.util.concurrent.Executors; 

public class TestUUID implements Runnable { 
        public static void main(String[] args) { 
                ExecutorService pool = Executors.newFixedThreadPool(5); 
                for (int i = 0; i < 80; i++) { 
                        pool.execute(new TestUUID()); 
                } 
                pool.shutdown(); 
        } 

        public static String genReqID() { 
                return UUID.randomUUID().toString().replace("-", "").toUpperCase(); 
        } 

        public void run() { 
                for (int i = 0; i < 10; i++) { 
                        System.out.println(genReqID()); 
                } 
        } 
}

 

posted @ 2015-10-13 20:21  真大闸蟹  阅读(696)  评论(0编辑  收藏  举报