package com.eactive.eai.rms.onl.common.util;

/**
 * Unique ID 생성 클래스입니다.
 * 
 */
public class UIDGenerator {
	
	private static long oldTime = System.currentTimeMillis();
	
	/**
	 * UID 리턴
	 * 
	 * @return
	 */
	public static synchronized String getUID() {
		
		if(oldTime == 0) {
			oldTime = System.currentTimeMillis();
		}
		
		long currentTime = System.currentTimeMillis();

		if(currentTime <= oldTime) {
			currentTime = oldTime + 1;
		}
		oldTime = currentTime;
		
		return Long.toString(currentTime);
	}
	
	
//	public static void main(String[] str) { //취약점소스 수정 2020.08.26
//	}
}