- 1、本文档共8页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
GridSim例8
package gridsim.example08;
/*
* Author Anthony Sulistio
* Date: December 2003
* Description: A simple program to demonstrate of how to create your own
* allocation policy.此程序用以演示如何自己创建分配策略
*
* NOTE: The values used from this example are taken from the GridSim paper.
* /gridsim/此程序中使用到的数据来源于有关GridSim的研究论文
* $Id: Example8.java,v 1.3 2004/05/29 05:53:28 anthony Exp $
*/
import java.util.*;
import gridsim.*;
/**
* Example8 class
*/
class Example8 extends GridSim
{
private Integer ID_;//Integer是对象
private String name_;
private GridletList list_;
private GridletList receiveList_;
private int totalResource_;
/**
* Allocates a new Example8 object
* @param name the Entity name of this object
* @param baud_rate the communication speed
* @param total_resource the number of grid resources available
* @throws Exception This happens when creating this entity before
* initializing GridSim package or the entity name is
* ttnull/tt or empty
* @see gridsim.GridSim#Init(int, Calendar, boolean, String[], String[],
* String)
*/
Example8(String name, double baud_rate, int total_resource, int numGridlet)
throws Exception
{
super(name, baud_rate);
_ = name;
this.totalResource_ = total_resource;
this.receiveList_ = new GridletList();
// Gets an ID for this entity为该实体获得一个ID地址
this.ID_ = new Integer( getEntityId(name) );
System.out.println(Creating a grid user entity with name = +
name + , and id = + this.ID_);
// Creates a list of Gridlets or Tasks for this grid user为该网格用户创建Gridlets或者任务列表
this.list_ = createGridlet(this.ID_.intValue(), numGridlet);
System.out.println(name + :Creating + this.list_.size() +
Gridlets);
}
/**
* The core method that handles communications among Gri
文档评论(0)