修复 高并发下generate()方法报requestIdGenerator空指针问题

This commit is contained in:
zendwang 2022-07-12 16:13:08 +08:00
parent e649b5415c
commit 04a3c93520
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ import java.util.Objects;
*/
public class IdGeneratorHelper {
private static RequestIdGenerator requestIdGenerator;
private RequestIdGenerator requestIdGenerator;
private volatile static IdGeneratorHelper INSTANCE;
@ -23,7 +23,7 @@ public class IdGeneratorHelper {
String requestIdGeneratorClass = liteflowConfig.getRequestIdGeneratorClass();
try {
Class<RequestIdGenerator> idGenerateClass = (Class<RequestIdGenerator>) Class.forName(requestIdGeneratorClass);
requestIdGenerator = ContextAwareHolder.loadContextAware().registerBean(idGenerateClass);
this.requestIdGenerator = ContextAwareHolder.loadContextAware().registerBean(idGenerateClass);
} catch (Exception e) {
throw new RequestIdGeneratorException(e.getMessage());
}
@ -44,7 +44,7 @@ public class IdGeneratorHelper {
}
public String generate() {
return requestIdGenerator.generate();
return this.requestIdGenerator.generate();
}
public void clear(){