cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/brokers/DatacenterBrokerAbstract.java
private boolean requestIdleVmDestruction(Vm vm, Function<Vm,Double>vmDestructionDelayFunction) {
        final double delay = vmDestructionDelayFunction.apply(vm);
        if (delay <= DEFAULT_VM_DESTRUCTION_DELAY){
            return false;
        }

        if(vm.getIdleInterval() >= delay) {
            //VM destruction request already was sent
            if(!vmExecList.contains(vm)){
                return true;
            }

            println(String.format("%.2f: %s: Destroying %s", getSimulation().clock(), getName(), vm));
            //request the Datacenter to destroy the VM
            sendNow(getVmDatacenter(vm).getId(), CloudSimTags.VM_DESTROY, vm);
            vmExecList.remove(vm);
            if (cloudletWaitingList.isEmpty() && vmExecList.isEmpty()) {
                println(String.format(
                    "%.2f: %s: Destroying VMs and requesting broker shutdown...",
                    getSimulation().clock(), getName()));
                requestShutDown();
            }
            return true;
        }

        /*
        Makes another request to the broker itself to check if the VM should be destroyed.
        The request will be processed only after the time specified by the delay has passed.
        */
        send(getId(), delay, CloudSimTags.VM_DESTROY, vm);
        return false;
    }
/**
     * Request an idle VM to be destroyed at the time defined by a delay {@link Function}.
     * The request will be sent if the given delay function returns a value
     * greater than {@link #DEFAULT_VM_DESTRUCTION_DELAY}.
     * Otherwise, it doesn't send the request, meaning the VM should not be destroyed according to a specific delay.
     *
     * @param vm the VM to destroy
     * @param vmDestructionDelayFunction a {@link Function} which indicates to time the VM will wait before being destructed
     * @return true if the VM was destroyed, false otherwise
     * @see #getVmDestructionDelayFunction()
     */
Request an idle VM to be destroyed at the time defined by a delay  Function.
The request will be sent if the given delay function returns a value
greater than  #DEFAULT_VM_DESTRUCTION_DELAY.
Otherwise, it doesn't send the request, meaning the VM should not be destroyed according to a specific delay.

@param vm the VM to destroy
@param vmDestructionDelayFunction a  Function which indicates to time the VM will wait before being destructed
@return true if the VM was destroyed, false otherwise
@see #getVmDestructionDelayFunction()
Request an idle VM to be destroyed at the time defined by a delay Function . The request will be sent if the given delay function returns a value greater than #DEFAULT_VM_DESTRUCTION_DELAY . Otherwise it doesn ' t send the request meaning the VM should not be destroyed according to a specific delay . @param vm the VM to destroy @param vmDestructionDelayFunction a Function which indicates to time the VM will wait before being destructed @return true if the VM was destroyed false otherwise @see #getVmDestructionDelayFunction ()
private boolean requestIdleVmDestruction(Vm vm, Function<Vm,Double>vmDestructionDelayFunction) {
        final double delay = vmDestructionDelayFunction.apply(vm);
        if (delay <= DEFAULT_VM_DESTRUCTION_DELAY){
            return false;
        }
        if(vm.getIdleInterval() >= delay) {
            if(!vmExecList.contains(vm)){
                return true;
            }
            println(String.format("%.2f: %s: Destroying %s", getSimulation().clock(), getName(), vm));
            sendNow(getVmDatacenter(vm).getId(), CloudSimTags.VM_DESTROY, vm);
            vmExecList.remove(vm);
            if (cloudletWaitingList.isEmpty() && vmExecList.isEmpty()) {
                println(String.format(
                    "%.2f: %s: Destroying VMs and requesting broker shutdown...",
                    getSimulation().clock(), getName()));
                requestShutDown();
            }
            return true;
        }
        /*
        Makes another request to the broker itself to check if the VM should be destroyed.
        The request will be processed only after the time specified by the delay has passed.
        */
        send(getId(), delay, CloudSimTags.VM_DESTROY, vm);
        return false;
    }
private boolean requestIdleVmDestruction ( Vm vm , Function < Vm , Double > vmDestructionDelayFunction ) { final double delay = vmDestructionDelayFunction . apply ( vm ) ; if ( delay <= DEFAULT_VM_DESTRUCTION_DELAY ) { return false ; } if ( vm . getIdleInterval ( ) >= delay ) { if ( ! vmExecList . contains ( vm ) ) { return true ; } println ( String . format ( "%.2f: %s: Destroying %s" , getSimulation ( ) . clock ( ) , getName ( ) , vm ) ) ; sendNow ( getVmDatacenter ( vm ) . getId ( ) , CloudSimTags . VM_DESTROY , vm ) ; vmExecList . remove ( vm ) ; if ( cloudletWaitingList . isEmpty ( ) && vmExecList . isEmpty ( ) ) { println ( String . format ( "%.2f: %s: Destroying VMs and requesting broker shutdown..." , getSimulation ( ) . clock ( ) , getName ( ) ) ) ; requestShutDown ( ) ; } return true ; } /*
        Makes another request to the broker itself to check if the VM should be destroyed.
        The request will be processed only after the time specified by the delay has passed.
        */ send ( getId ( ) , delay , CloudSimTags . VM_DESTROY , vm ) ; return false ; }
Request an idle VM to be destroyed at the time defined by a delay {@link Function}.
Request an idle VM to be destroyed at the time defined by a delay { @link Function } .
//VM destruction request already was sent //request the Datacenter to destroy the VM