cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/brokers/DatacenterBrokerAbstract.java
protected void processCloudletReturn(SimEvent ev) {
        final Cloudlet c = (Cloudlet) ev.getData();
        cloudletsFinishedList.add(c);
        println(String.format("%.2f: %s: %s %d finished and returned to broker.",
            getSimulation().clock(), getName(), c.getClass().getSimpleName(), c.getId()));
        cloudletsCreated--;

        if(isNotAllRunningCloudletsReturned()){
            requestIdleVmDestruction(c.getVm(), vmDestructionDelayFunction);
            return;
        }

        final Function<Vm, Double> func = vmDestructionDelayFunction.apply(c.getVm()) < 0 ? vm -> 0.0 : vmDestructionDelayFunction;
        //If gets here, all running cloudlets have finished and returned to the broker.
        if (cloudletWaitingList.isEmpty()) {
            println(String.format(
                "%.2f: %s: All submitted Cloudlets finished executing.",
                getSimulation().clock(), getName()));
            requestIdleVmsDestruction(func);
            return;
        }

        /*There are some cloudlets waiting their VMs to be created.
        Then, destroys finished VMs and requests creation of waiting ones.
        When there is waiting Cloudlets, it always request the destruction
        of idle VMs to possibly free resources to start waiting
        VMs. This way, the a VM destruction delay function is not set,
        defines one which always return 0 to indicate
        that in this situation, idle VMs must be destroyed immediately.
        */
        requestIdleVmsDestruction(func);
        requestDatacenterToCreateWaitingVms();
    }
/**
     * Processes the end of execution of a given cloudlet inside a Vm.
     *
     * @param ev the cloudlet that has just finished to execute and was returned to the broker
     * @pre ev != $null
     * @post $none
     */
Processes the end of execution of a given cloudlet inside a Vm.
@param ev the cloudlet that has just finished to execute and was returned to the broker
@pre ev != $null
@post $none
Processes the end of execution of a given cloudlet inside a Vm . @param ev the cloudlet that has just finished to execute and was returned to the broker @pre ev ! = $null @post $none
protected void processCloudletReturn(SimEvent ev) {
        final Cloudlet c = (Cloudlet) ev.getData();
        cloudletsFinishedList.add(c);
        println(String.format("%.2f: %s: %s %d finished and returned to broker.",
            getSimulation().clock(), getName(), c.getClass().getSimpleName(), c.getId()));
        cloudletsCreated--;
        if(isNotAllRunningCloudletsReturned()){
            requestIdleVmDestruction(c.getVm(), vmDestructionDelayFunction);
            return;
        }
        final Function<Vm, Double> func = vmDestructionDelayFunction.apply(c.getVm()) < 0 ? vm -> 0.0 : vmDestructionDelayFunction;
        if (cloudletWaitingList.isEmpty()) {
            println(String.format(
                "%.2f: %s: All submitted Cloudlets finished executing.",
                getSimulation().clock(), getName()));
            requestIdleVmsDestruction(func);
            return;
        }
        /*There are some cloudlets waiting their VMs to be created.
        Then, destroys finished VMs and requests creation of waiting ones.
        When there is waiting Cloudlets, it always request the destruction
        of idle VMs to possibly free resources to start waiting
        VMs. This way, the a VM destruction delay function is not set,
        defines one which always return 0 to indicate
        that in this situation, idle VMs must be destroyed immediately.
        */
        requestIdleVmsDestruction(func);
        requestDatacenterToCreateWaitingVms();
    }
protected void processCloudletReturn ( SimEvent ev ) { final Cloudlet c = ( Cloudlet ) ev . getData ( ) ; cloudletsFinishedList . add ( c ) ; println ( String . format ( "%.2f: %s: %s %d finished and returned to broker." , getSimulation ( ) . clock ( ) , getName ( ) , c . getClass ( ) . getSimpleName ( ) , c . getId ( ) ) ) ; cloudletsCreated -- ; if ( isNotAllRunningCloudletsReturned ( ) ) { requestIdleVmDestruction ( c . getVm ( ) , vmDestructionDelayFunction ) ; return ; } final Function < Vm , Double > func = vmDestructionDelayFunction . apply ( c . getVm ( ) ) < 0 ? vm -> 0.0 : vmDestructionDelayFunction ; if ( cloudletWaitingList . isEmpty ( ) ) { println ( String . format ( "%.2f: %s: All submitted Cloudlets finished executing." , getSimulation ( ) . clock ( ) , getName ( ) ) ) ; requestIdleVmsDestruction ( func ) ; return ; } /*There are some cloudlets waiting their VMs to be created.
        Then, destroys finished VMs and requests creation of waiting ones.
        When there is waiting Cloudlets, it always request the destruction
        of idle VMs to possibly free resources to start waiting
        VMs. This way, the a VM destruction delay function is not set,
        defines one which always return 0 to indicate
        that in this situation, idle VMs must be destroyed immediately.
        */ requestIdleVmsDestruction ( func ) ; requestDatacenterToCreateWaitingVms ( ) ; }
Processes the end of execution of a given cloudlet inside a Vm.
Processes the end of execution of a given cloudlet inside a Vm .
//If gets here, all running cloudlets have finished and returned to the broker.