Commit 5c5c8cd5 authored by Nikolay's avatar Nikolay

Performance improvement of DatcenterBroker::submitCloudlets().

parent 2faca426
...@@ -340,6 +340,7 @@ public class DatacenterBroker extends SimEntity { ...@@ -340,6 +340,7 @@ public class DatacenterBroker extends SimEntity {
*/ */
protected void submitCloudlets() { protected void submitCloudlets() {
int vmIndex = 0; int vmIndex = 0;
List<Cloudlet> successfullySubmitted = new ArrayList<Cloudlet>();
for (Cloudlet cloudlet : getCloudletList()) { for (Cloudlet cloudlet : getCloudletList()) {
Vm vm; Vm vm;
// if user didn't bind this cloudlet and it has not been executed yet // if user didn't bind this cloudlet and it has not been executed yet
...@@ -361,12 +362,11 @@ public class DatacenterBroker extends SimEntity { ...@@ -361,12 +362,11 @@ public class DatacenterBroker extends SimEntity {
cloudletsSubmitted++; cloudletsSubmitted++;
vmIndex = (vmIndex + 1) % getVmsCreatedList().size(); vmIndex = (vmIndex + 1) % getVmsCreatedList().size();
getCloudletSubmittedList().add(cloudlet); getCloudletSubmittedList().add(cloudlet);
successfullySubmitted.add(cloudlet);
} }
// remove submitted cloudlets from waiting list // remove submitted cloudlets from waiting list
for (Cloudlet cloudlet : getCloudletSubmittedList()) { getCloudletList().removeAll(successfullySubmitted);
getCloudletList().remove(cloudlet);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment