cloudsim源代码学习:cloudcoordinator.java

/*
 * Title:        CloudSim Toolkit
 * Description:  CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 *
 * Copyright (c) 2009-2010, The University of Melbourne, Australia
 */

package org.cloudbus.cloudsim;

import java.util.List;

/**
 * This class represents the coordinator of a federation of clouds.
 * It interacts with other clouds coordinators in order to exchange
 * virtual machines and user applicatoins, if required.
 *
 * @author		Rodrigo N. Calheiros
 * @since		CloudSim Toolkit 1.0
 */
 //该类表示联合云的协调者。它与其他云协调者交互,以交换VM和用户程序
public abstract class CloudCoordinator {

	//数据中心
	/** The datacenter. */
	protected FederatedDatacenter datacenter;

	//联合云
	/** The federation. */
	protected List<Integer> federation;

	/**
	 * Defines the FederatedDataCenter this coordinator works for.
	 *
	 * @param datacenter FederatedDataCenter associated to this coordinator.
	 *
	 * @pre $none
	 * @post $none
	 */
	 //设置该协调者负责的联合云
	public void setDatacenter(FederatedDatacenter datacenter){
		this.datacenter = datacenter;
	}

	/**
	 * Informs about the other data centers that are part of the federation.
	 *
	 * @param federationList List of DataCenters ids that are part of the federation
	 *
	 * @pre federationList != null
	 * @post $none
	 */
	 //通知该联合云的其他数据中心
	public void setFederation(List<Integer> federationList) {
		this.federation = federationList;
	}

	/**
	 * This method is periodically called by the FederatedDataCenter to
	 * makethe coordinator update the sensors measuring in order to decide
	 * if modification in the data center must be processed. This modification
	 * requires migration of virtual machines and/or user applications from
	 * one data center to another.
	 *
	 * @pre $none
	 * @post $none
	 */
	 //该方法周期性调用来更新探测器以决定是否数据中心的更改需要处理。该修改请求VM或用户程序迁移
	public void updateDatacenter() {
		for (Sensor<Double> s : this.datacenter.getSensors()) {
			int result = s.monitor();
			if (result != 0) {
				migrate(s, result);
			}
		}
	}

	/**
	 * Implements a specific migration policy to be deployed by the cloud coordinator.
	 *
	 * @param result the result vof the last measurement:
	 * -1 if the measurement fell below the lower threshold
	 * +1 if the measurement fell above the higher threshold
	 * @param sensor the sensor
	 *
	 * @pre sensor != null
	 * @post $none
	 */
	 //实现特定的迁移策略
	protected abstract void migrate(Sensor<Double> sensor,int result);

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值