cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/brokers/DatacenterBrokerAbstract.java
protected void requestDatacentersToCreateWaitingCloudlets() {
        final List<Cloudlet> successfullySubmitted = new ArrayList<>();
        for (final Cloudlet cloudlet : cloudletWaitingList) {
            if (cloudletCreationRequestsMap.containsKey(cloudlet)) {
                continue;
            }

            //selects a VM for the given Cloudlet
            lastSelectedVm = vmMapper.apply(cloudlet);
            if (lastSelectedVm == Vm.NULL) {
                // vm was not created
                println(String.format(
                    "%.2f: %s: : Postponing execution of cloudlet %d: bind VM not available.",
                    getSimulation().clock(), getName(), cloudlet.getId()));
                continue;
            }

            final String delayStr =
                cloudlet.getSubmissionDelay() > 0 ?
                    String.format(" with a requested delay of %.0f seconds", cloudlet.getSubmissionDelay()) :
                    "";
            println(String.format(
                "%.2f: %s: Sending %s %d to %s in %s%s.",
                getSimulation().clock(), getName(), cloudlet.getClass().getSimpleName(), cloudlet.getId(),
                lastSelectedVm, lastSelectedVm.getHost(), delayStr));
            cloudlet.setVm(lastSelectedVm);
            send(getVmDatacenter(lastSelectedVm).getId(),
                cloudlet.getSubmissionDelay(), CloudSimTags.CLOUDLET_SUBMIT, cloudlet);
            cloudletCreationRequestsMap.put(cloudlet, getVmDatacenter(lastSelectedVm));
            cloudletsCreated++;
            successfullySubmitted.add(cloudlet);
        }

        // remove created cloudlets from waiting list
        cloudletWaitingList.removeAll(successfullySubmitted);
    }
/**
     * <p>Request Datacenters to create the Cloudlets in the
     * {@link #getCloudletWaitingList() Cloudlets waiting list}.
     * If there aren't available VMs to host all cloudlets,
     * the creation of some ones will be postponed.</p>
     * <p>
     * <p>This method is called after all submitted VMs are created
     * in some Datacenter.</p>
     *
     * @pre $none
     * @post $none
     * @todo @author manoelcampos Where is checked if the Vm to where
     * a cloudlet was submitted has the required resources?
     * @see #submitCloudletList(java.util.List)
     */
Request Datacenters to create the Cloudlets in the
#getCloudletWaitingList() Cloudlets waiting list.
If there aren't available VMs to host all cloudlets,
the creation of some ones will be postponed.

This method is called after all submitted VMs are created
in some Datacenter.

@pre $none
@post $none
@todo @author manoelcampos Where is checked if the Vm to where
a cloudlet was submitted has the required resources.
Request Datacenters to create the Cloudlets in the #getCloudletWaitingList () Cloudlets waiting list . If there aren ' t available VMs to host all cloudlets the creation of some ones will be postponed . This method is called after all submitted VMs are created in some Datacenter . @pre $none @post $none @todo @author manoelcampos Where is checked if the Vm to where a cloudlet was submitted has the required resources .
protected void requestDatacentersToCreateWaitingCloudlets() {
        final List<Cloudlet> successfullySubmitted = new ArrayList<>();
        for (final Cloudlet cloudlet : cloudletWaitingList) {
            if (cloudletCreationRequestsMap.containsKey(cloudlet)) {
                continue;
            }
            lastSelectedVm = vmMapper.apply(cloudlet);
            if (lastSelectedVm == Vm.NULL) {
                println(String.format(
                    "%.2f: %s: : Postponing execution of cloudlet %d: bind VM not available.",
                    getSimulation().clock(), getName(), cloudlet.getId()));
                continue;
            }
            final String delayStr =
                cloudlet.getSubmissionDelay() > 0 ?
                    String.format(" with a requested delay of %.0f seconds", cloudlet.getSubmissionDelay()) :
                    "";
            println(String.format(
                "%.2f: %s: Sending %s %d to %s in %s%s.",
                getSimulation().clock(), getName(), cloudlet.getClass().getSimpleName(), cloudlet.getId(),
                lastSelectedVm, lastSelectedVm.getHost(), delayStr));
            cloudlet.setVm(lastSelectedVm);
            send(getVmDatacenter(lastSelectedVm).getId(),
                cloudlet.getSubmissionDelay(), CloudSimTags.CLOUDLET_SUBMIT, cloudlet);
            cloudletCreationRequestsMap.put(cloudlet, getVmDatacenter(lastSelectedVm));
            cloudletsCreated++;
            successfullySubmitted.add(cloudlet);
        }
        cloudletWaitingList.removeAll(successfullySubmitted);
    }
protected void requestDatacentersToCreateWaitingCloudlets ( ) { final List < Cloudlet > successfullySubmitted = new ArrayList < > ( ) ; for ( final Cloudlet cloudlet : cloudletWaitingList ) { if ( cloudletCreationRequestsMap . containsKey ( cloudlet ) ) { continue ; } lastSelectedVm = vmMapper . apply ( cloudlet ) ; if ( lastSelectedVm == Vm . NULL ) { println ( String . format ( "%.2f: %s: : Postponing execution of cloudlet %d: bind VM not available." , getSimulation ( ) . clock ( ) , getName ( ) , cloudlet . getId ( ) ) ) ; continue ; } final String delayStr = cloudlet . getSubmissionDelay ( ) > 0 ? String . format ( " with a requested delay of %.0f seconds" , cloudlet . getSubmissionDelay ( ) ) : "" ; println ( String . format ( "%.2f: %s: Sending %s %d to %s in %s%s." , getSimulation ( ) . clock ( ) , getName ( ) , cloudlet . getClass ( ) . getSimpleName ( ) , cloudlet . getId ( ) , lastSelectedVm , lastSelectedVm . getHost ( ) , delayStr ) ) ; cloudlet . setVm ( lastSelectedVm ) ; send ( getVmDatacenter ( lastSelectedVm ) . getId ( ) , cloudlet . getSubmissionDelay ( ) , CloudSimTags . CLOUDLET_SUBMIT , cloudlet ) ; cloudletCreationRequestsMap . put ( cloudlet , getVmDatacenter ( lastSelectedVm ) ) ; cloudletsCreated ++ ; successfullySubmitted . add ( cloudlet ) ; } cloudletWaitingList . removeAll ( successfullySubmitted ) ; }
<p>Request Datacenters to create the Cloudlets in the
 {@link #getCloudletWaitingList() Cloudlets waiting list}.
<p > Request Datacenters to create the Cloudlets in the { @link #getCloudletWaitingList () Cloudlets waiting list } .
//selects a VM for the given Cloudlet // vm was not created // remove created cloudlets from waiting list