myriad-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smare...@apache.org
Subject incubator-myriad git commit: MYRIAD-160 Addressing review comment about removing port after being …
Date Thu, 29 Oct 2015 21:45:13 GMT
Repository: incubator-myriad
Updated Branches:
  refs/heads/master cff2ea219 -> 47d90dad7


MYRIAD-160 Addressing review comment about removing port after being …

…selected for use in NM

This closes: #27
Review: https://github.com/apache/incubator-myriad/pull/27


Project: http://git-wip-us.apache.org/repos/asf/incubator-myriad/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-myriad/commit/47d90dad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-myriad/tree/47d90dad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-myriad/diff/47d90dad

Branch: refs/heads/master
Commit: 47d90dad7968d208c19455697bf0997cb4a51882
Parents: cff2ea2
Author: Yuliya Feldman <yfeldman@maprtech.com>
Authored: Thu Oct 29 14:44:27 2015 -0700
Committer: Santosh Marella <marella@gmail.com>
Committed: Thu Oct 29 14:44:27 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/myriad/scheduler/TaskFactory.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/47d90dad/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/TaskFactory.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/TaskFactory.java b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/TaskFactory.java
index ad0ec0d..46cd12b 100644
--- a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/TaskFactory.java
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/TaskFactory.java
@@ -108,12 +108,13 @@ public interface TaskFactory {
             }
           }
         }
-        final int allAvailablePortsSize = allAvailablePorts.size();
+
         Preconditions.checkState(allAvailablePorts.size() >= NMPorts.expectedNumPorts(),
"Not enough ports in offer");
         
         while (ports.size() < NMPorts.expectedNumPorts()) {
-          int portIndex = rand.nextInt(allAvailablePortsSize);
+          int portIndex = rand.nextInt(allAvailablePorts.size());
           ports.add(allAvailablePorts.get(portIndex));
+          allAvailablePorts.remove(portIndex);
         }        
       }
       return ports;


Mime
View raw message