You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/12/18 05:49:35 UTC

[GitHub] [incubator-dolphinscheduler] hu-hongtao opened a new issue #4258: [Question]about org.apache.dolphinscheduler.server.master.dispatch.host.assign.RoundRobinSelector.java

hu-hongtao opened a new issue #4258:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4258


   git branch: 1.3.4
   My English is litmited. Sorry.
   I was confused about this class.
   `@Service
   public class RoundRobinSelector<T> implements Selector<T> {
   
       private final AtomicInteger index = new AtomicInteger(0);
   
       @Override
       public T select(Collection<T> source) {
           if (source == null || source.size() == 0) {
               throw new IllegalArgumentException("Empty source.");
           }
   
           /**
            * if only one , return directly
            */
           if (source.size() == 1) {
               return (T)source.toArray()[0];
           }
   
           int size = source.size();
           /**
            * round robin
            */
           return (T) source.toArray()[index.getAndIncrement() % size];
       }
   }
   `
   
   In theory,it may occur exception. when ths AtomicInteger'value is larger than Integer.MAX_VALUE,  the method of 'select' can also work right?
   
   
   Thanks!
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] chengshiwen closed issue #4258: [Question]about org.apache.dolphinscheduler.server.master.dispatch.host.assign.RoundRobinSelector.java

Posted by GitBox <gi...@apache.org>.
chengshiwen closed issue #4258:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4258


   


-- 
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:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] hu-hongtao commented on issue #4258: [Question]about org.apache.dolphinscheduler.server.master.dispatch.host.assign.RoundRobinSelector.java

Posted by GitBox <gi...@apache.org>.
hu-hongtao commented on issue #4258:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4258#issuecomment-747962565


   Thanks for your reply. I will take a loot at the dev version. 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] chengshiwen commented on issue #4258: [Question]about org.apache.dolphinscheduler.server.master.dispatch.host.assign.RoundRobinSelector.java

Posted by GitBox <gi...@apache.org>.
chengshiwen commented on issue #4258:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4258#issuecomment-817109308


   Close the question since it has been replied


-- 
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:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] CalvinKirs commented on issue #4258: [Question]about org.apache.dolphinscheduler.server.master.dispatch.host.assign.RoundRobinSelector.java

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on issue #4258:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4258#issuecomment-747938290


   You are right, but the probability of this kind of problem is very low. In addition, in the dev version, we have made changes. You can have a look.


----------------------------------------------------------------
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:
users@infra.apache.org