-
-
Save anonymous/e068ad4366c7759c58dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String getUniqueFileId(){ | |
String fileId=getRandomString(FILE_ID_LENGTH); | |
LoggerDAO loggerDao = ObjectContainer.getObject("LoggerDAO"); | |
int count = 1; | |
try { | |
while(!loggerDao.isFileIdUnique(fileId)){ | |
Logger.log(componentName, levelInfo, requestTransaction, | |
sourceId, customerId,null, "File Id:"+fileId+" exists. Retry new fileId ..!"); | |
fileId=getRandomString(FILE_ID_LENGTH); | |
if(count++ > 20){ | |
Logger.log(componentName,levelDebug, requestTransaction, | |
sourceId, customerId,null, "Finding unique key took 21 cycles,It's time to increase the key size..!"); | |
} | |
} | |
} catch (DataAccessException e) { | |
Logger.log(componentName,levelError, requestTransaction, | |
sourceId, customerId,e, "Error in validating the uniqueness of fileId.."); | |
} | |
return fileId; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment