/** * This method is used to send to the broker the list of cloudlets. * * @param list the list * @pre list !=null * @post $none * * @todo The name of the method is confused with the {@link #submitCloudlets()}, * that in fact submit cloudlets to VMs. The term "submit" is being used * ambiguously. The method {@link #submitCloudlets()} would be named "sendCloudletsToVMs" * * The method {@link #submitVmList(java.util.List)} may have * be checked too. */ public void submitCloudletList(List<? extends Cloudlet> list) { getCloudletList().addAll(list); }
/** * Specifies that a given cloudlet must run in a specific virtual machine. * * @param cloudletId ID of the cloudlet being bount to a vm * @param vmId the vm id * @pre cloudletId > 0 * @pre id > 0 * @post $none */ public void bindCloudletToVm(int cloudletId, int vmId) { CloudletList.getById(getCloudletList(), cloudletId).setVmId(vmId); }
/** * Process a cloudlet return event. * * @param ev a SimEvent object * @pre ev != $null * @post $none */ protected void processCloudletReturn(SimEvent ev) { Cloudlet cloudlet = (Cloudlet) ev.getData(); getCloudletReceivedList().add(cloudlet); Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Cloudlet ", cloudlet.getCloudletId(), " received"); cloudletsSubmitted--; if (getCloudletList().size() == 0 && cloudletsSubmitted == 0) { // all cloudlets executed Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": All Cloudlets executed. Finishing..."); clearDatacenters(); finishExecution(); } else { // some cloudlets haven't finished yet if (getCloudletList().size() > 0 && cloudletsSubmitted == 0) { // all the cloudlets sent finished. It means that some bount // cloudlet is waiting its VM be created clearDatacenters(); createVmsInDatacenter(0); } } }
int vmIndex = 0; List<Cloudlet> successfullySubmitted = new ArrayList<Cloudlet>(); for (Cloudlet cloudlet : getCloudletList()) { Vm vm; getCloudletList().removeAll(successfullySubmitted);