junkaixue commented on code in PR #2065:
URL: https://github.com/apache/helix/pull/2065#discussion_r860286211


##########
helix-core/src/main/java/org/apache/helix/task/RuntimeJobDag.java:
##########
@@ -198,11 +198,15 @@ public void generateJobList() {
     resetJobListAndDependencyMaps();
     computeIndependentNodes();
     _readyJobList.addAll(_independentNodes);
-    if (_isJobQueue && _readyJobList.size() > 0) {
+    if (_isJobQueue && !_readyJobList.isEmpty()) {

Review Comment:
   Not quite sure whether this is just a style change? If we dont change it, 
would it cause any problem?



##########
helix-core/src/main/java/org/apache/helix/task/RuntimeJobDag.java:
##########
@@ -198,11 +198,15 @@ public void generateJobList() {
     resetJobListAndDependencyMaps();
     computeIndependentNodes();
     _readyJobList.addAll(_independentNodes);
-    if (_isJobQueue && _readyJobList.size() > 0) {
+    if (_isJobQueue && !_readyJobList.isEmpty()) {
       // For job queue, only get number of parallel jobs to run in the ready 
list.
       for (int i = 1; i < _numParallelJobs; i++) {
-        if (_parentsToChildren.containsKey(_readyJobList.peekLast())) {
-          
_readyJobList.offer(_parentsToChildren.get(_readyJobList.peekLast()).iterator().next());
+        String parent = _readyJobList.peekLast();
+        Set<String> children = _parentsToChildren.get(parent);
+        if (children != null) {
+          _readyJobList.offer(children.iterator().next());
+        } else {
+          break;

Review Comment:
   NIT: it would be better make it as:
   
   if (children == null) {
   break;
   } 
   
   _readyJobList.offer(children.iterator().next());



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to