Jave-Chen commented on a change in pull request #2242: Adapting partial
code(file name start with Q) to the sonar cloud rule
URL:
https://github.com/apache/incubator-dolphinscheduler/pull/2242#discussion_r395944928
##########
File path:
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
##########
@@ -70,9 +70,10 @@ public static QuartzExecutors getInstance() {
synchronized (QuartzExecutors.class) {
// when more than two threads run into the first null check same time,
to avoid instanced more than one time, it needs to be checked again.
if (INSTANCE == null) {
- INSTANCE = new QuartzExecutors();
+ QuartzExecutors quartzExecutors = new QuartzExecutors();
//finish QuartzExecutors init
- INSTANCE.init();
+ quartzExecutors.init();
+ INSTANCE = quartzExecutors;
}
Review comment:
Fully initialize "INSTANCE" before assigning it.
https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&issues=AW9_bPn7ek8Jf6Q3VCKX&open=AW9_bPn7ek8Jf6Q3VCKX
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services