cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/datacenters/DatacenterSimple.java
protected void processCloudletMove(final Object[] receivedData, final int type) {
        updateCloudletProcessing();

        final Cloudlet cloudlet = (Cloudlet)receivedData[0];
        final int destVmId = (int)receivedData[1];

        final Vm sourceVm = cloudlet.getVm();
        final Host sourceHost = sourceVm.getHost();
        final Vm destVm = sourceHost.getVm(destVmId, cloudlet.getBroker().getId());
        final int destDatacenterId = destVm.getHost().getDatacenter().getId();
        final Cloudlet cl = sourceVm.getCloudletScheduler().cloudletCancel(cloudlet.getId());

        if (Cloudlet.NULL.equals(cl)) {
            return;
        }

        // Has the cloudlet already finished?
        if (cl.getStatus() == Cloudlet.Status.SUCCESS) {// if yes, send it back to user
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_SUBMIT_ACK, cl);
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_RETURN, cl);
        }

        // Prepare cloudlet for migration
        cl.setVm(destVm);

        if (destDatacenterId != getId())
            requestClodletMigrationToOtherDc(type, destDatacenterId, cl);
        else requestCloudletMigrationToOtherVm(destVm, cl);

        if (type == CloudSimTags.CLOUDLET_MOVE_ACK) {// send ACK if requested
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_SUBMIT_ACK, cloudlet);
        }
    }
/**
     * Process the event for a Broker who wants to move a Cloudlet.
     *
     * @param receivedData an Object array containing data about the migration,
     *                     where the index 0 will be a Cloudlet and
     *                     the index 1 will be the id of the destination VM
     * @param type event type
     *
     * @pre receivedData != null
     * @pre type > 0
     * @post $none
     */
Process the event for a Broker who wants to move a Cloudlet.
@param receivedData an Object array containing data about the migration,
where the index 0 will be a Cloudlet and
the index 1 will be the id of the destination VM
@param type event type

@pre receivedData != null
@pre type > 0
@post $none
Process the event for a Broker who wants to move a Cloudlet . @param receivedData an Object array containing data about the migration where the index 0 will be a Cloudlet and the index 1 will be the id of the destination VM @param type event type @pre receivedData ! = null @pre type > 0 @post $none
protected void processCloudletMove(final Object[] receivedData, final int type) {
        updateCloudletProcessing();
        final Cloudlet cloudlet = (Cloudlet)receivedData[0];
        final int destVmId = (int)receivedData[1];
        final Vm sourceVm = cloudlet.getVm();
        final Host sourceHost = sourceVm.getHost();
        final Vm destVm = sourceHost.getVm(destVmId, cloudlet.getBroker().getId());
        final int destDatacenterId = destVm.getHost().getDatacenter().getId();
        final Cloudlet cl = sourceVm.getCloudletScheduler().cloudletCancel(cloudlet.getId());
        if (Cloudlet.NULL.equals(cl)) {
            return;
        }
        if (cl.getStatus() == Cloudlet.Status.SUCCESS) {
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_SUBMIT_ACK, cl);
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_RETURN, cl);
        }
        cl.setVm(destVm);
        if (destDatacenterId != getId())
            requestClodletMigrationToOtherDc(type, destDatacenterId, cl);
        else requestCloudletMigrationToOtherVm(destVm, cl);
        if (type == CloudSimTags.CLOUDLET_MOVE_ACK) {
            sendNow(cl.getBroker().getId(), CloudSimTags.CLOUDLET_SUBMIT_ACK, cloudlet);
        }
    }
protected void processCloudletMove ( final Object [ ] receivedData , final int type ) { updateCloudletProcessing ( ) ; final Cloudlet cloudlet = ( Cloudlet ) receivedData [ 0 ] ; final int destVmId = ( int ) receivedData [ 1 ] ; final Vm sourceVm = cloudlet . getVm ( ) ; final Host sourceHost = sourceVm . getHost ( ) ; final Vm destVm = sourceHost . getVm ( destVmId , cloudlet . getBroker ( ) . getId ( ) ) ; final int destDatacenterId = destVm . getHost ( ) . getDatacenter ( ) . getId ( ) ; final Cloudlet cl = sourceVm . getCloudletScheduler ( ) . cloudletCancel ( cloudlet . getId ( ) ) ; if ( Cloudlet . NULL . equals ( cl ) ) { return ; } if ( cl . getStatus ( ) == Cloudlet . Status . SUCCESS ) { sendNow ( cl . getBroker ( ) . getId ( ) , CloudSimTags . CLOUDLET_SUBMIT_ACK , cl ) ; sendNow ( cl . getBroker ( ) . getId ( ) , CloudSimTags . CLOUDLET_RETURN , cl ) ; } cl . setVm ( destVm ) ; if ( destDatacenterId != getId ( ) ) requestClodletMigrationToOtherDc ( type , destDatacenterId , cl ) ; else requestCloudletMigrationToOtherVm ( destVm , cl ) ; if ( type == CloudSimTags . CLOUDLET_MOVE_ACK ) { sendNow ( cl . getBroker ( ) . getId ( ) , CloudSimTags . CLOUDLET_SUBMIT_ACK , cloudlet ) ; } }
Process the event for a Broker who wants to move a Cloudlet.
Process the event for a Broker who wants to move a Cloudlet .
// Has the cloudlet already finished? // if yes, send it back to user // Prepare cloudlet for migration // send ACK if requested