wwj-go commented on a change in pull request #1663:
URL: 
https://github.com/apache/shardingsphere-elasticjob/pull/1663#discussion_r512383248



##########
File path: 
elasticjob-lite/elasticjob-lite-core/src/test/java/org/apache/shardingsphere/elasticjob/lite/api/bootstrap/impl/OneOffJobBootstrapTest.java
##########
@@ -105,9 +105,9 @@ private Scheduler getScheduler(final OneOffJobBootstrap 
oneOffJobBootstrap) {
     }
 
     @SneakyThrows
-    private void blockUtilFinish(final OneOffJobBootstrap oneOffJobBootstrap) {
+    private void blockUtilFinish(final OneOffJobBootstrap oneOffJobBootstrap, 
final AtomicInteger counter) {
         Scheduler scheduler = getScheduler(oneOffJobBootstrap);
-        while (!scheduler.isStarted() || 
!scheduler.getCurrentlyExecutingJobs().isEmpty()) {

Review comment:
       This case fails in some case because there is a little period between 
`scheduler.isStarted() and !scheduler.getCurrentlyExecutingJobs().isEmpty()` .
   For the execution of a scheduler, it will set the start flag true, then set 
the scheduler.getCurrentlyExecutingJobs() not empty. If a thread check the 
while condition between the two steps , the `scheduler.isStarted()` returns 
true and the `scheduler.getCurrentlyExecutingJobs().isEmpty()` also returns 
true, then it will get away  from the loop and do assert,which results in 
failure.




----------------------------------------------------------------
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]


Reply via email to