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:
[email protected]


Reply via email to