⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractgis.java

📁 中間件開發详细说明:清华大学J2EE教程讲义(ppt)-Tsinghua University J2EE tutorial lectures (ppt) [上载源码成为会员下载此源码] [成为VIP会
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Title:        GridSim Toolkit * Description:  GridSim (Grid Simulation) Toolkit for Modeling and Simulation *               of Parallel and Distributed Systems such as Clusters and Grids * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html * * $Id: AbstractGIS.java,v 1.8 2007/08/30 01:38:43 anthony Exp $ */package gridsim.index;import gridsim.*;import gridsim.net.*;import eduni.simjava.*;import java.util.*;/** * AbstractGIS is an abstract class which aims to provide skeletons for its * chid classes to implement the required base functionalities of a regional * GridInformationService (GIS). * * @author       Anthony Sulistio * @since        GridSim Toolkit 3.2 * @invariant $none */public abstract class AbstractGIS extends GridSimCore{    /** System GIS or {@link gridsim.GridInformationService} entity ID. */    protected int systemGIS_ = -1;    // if there is a conflict, we can simply change this number    private static final int GIS_BASE = 1000;    /** Registers this regional GIS to the     * {@link gridsim.GridInformationService} or system GIS.     * This tag should be called from Regional GIS to the system GIS.     */    public static final int REGISTER_REGIONAL_GIS = GIS_BASE + 1;    /** Denotes a grid resource to be registered to this regional GIS entity.     * This tag is similar to {@link gridsim.GridSimTags#REGISTER_RESOURCE}.     * This tag should be called from Regional GIS to the system GIS.     */    public static final int REGISTER_RESOURCE = GIS_BASE + 2;    /** Denotes a grid resource, that can support advance reservation, to be     * registered to this regional GIS entity.     * This tag is similar to {@link gridsim.GridSimTags#REGISTER_RESOURCE_AR}.     * This tag should be called from Regional GIS to the system GIS.     */    public static final int REGISTER_RESOURCE_AR = GIS_BASE + 3;    /** Denotes a list of all resources, including the ones that can support     * advance reservation, that are listed in this regional GIS entity.     * This tag is similar to {@link gridsim.GridSimTags#RESOURCE_LIST}.     * This tag should be called from a user to Regional GIS.     */    public static final int INQUIRY_LOCAL_RESOURCE_LIST = GIS_BASE + 4;    /** Denotes a list of resources, that only support     * advance reservation, that are listed in this regional GIS entity.     * This tag is similar to {@link gridsim.GridSimTags#RESOURCE_AR_LIST}.     * This tag should be called from a user to Regional GIS.     */    public static final int INQUIRY_LOCAL_RESOURCE_AR_LIST = GIS_BASE + 5;    /** Denotes a list of resources that are listed in other regional GIS     * entities.     * This tag should be called from a user to Regional GIS.     */    public static final int INQUIRY_GLOBAL_RESOURCE_LIST = GIS_BASE + 6;    /** Denotes a list of resources, which support advanced reservation,     * that are listed in other regional GIS entities.     * This tag should be called from a user to Regional GIS.     */    public static final int INQUIRY_GLOBAL_RESOURCE_AR_LIST = GIS_BASE + 7;    /** Denotes a list of regional GIS IDs, including this entity ID.     * This tag should be called from a user to Regional GIS.     */    public static final int INQUIRY_REGIONAL_GIS = GIS_BASE + 8;    /** Denotes an inquiry regarding to a list of local resources.     * This tag should be called from a Regional GIS to another.     */    public static final int GIS_INQUIRY_RESOURCE_LIST = GIS_BASE + 9;    /** Denotes a result regarding to a list of local resources.     * This tag should be called from a Regional GIS to a sender Regional GIS.     */    public static final int GIS_INQUIRY_RESOURCE_RESULT = GIS_BASE + 10;    /** Denotes an inquiry regarding to a list of local resources,     * which supports advanced reservation.     * This tag should be called from a Regional GIS to another.     */    public static final int GIS_INQUIRY_RESOURCE_AR_LIST = GIS_BASE + 11;    /** Denotes a result regarding to a list of local resources,     * which supports advanced reservation.     * This tag should be called from a Regional GIS to a sender Regional GIS.     */    public static final int GIS_INQUIRY_RESOURCE_AR_RESULT = GIS_BASE + 12;    /** Denotes an inquiry regarding to a resource failure.     * The user sends this tag to the GIS to update its list of resources.     */    public static final int NOTIFY_GIS_RESOURCE_FAILURE = GIS_BASE + 13;    /**     * Creates a new regional GIS entity     * @param name  this regional GIS name     * @param link  a network link to this entity     * @throws Exception This happens when creating this entity before     *                   initializing GridSim package or this entity name is     *                   <tt>null</tt> or empty     * @pre name != null     * @pre link != null     * @post $none     */    protected AbstractGIS(String name, Link link) throws Exception {        super(name, link);    }    /**     * Handles incoming requests to this entity, <b>DO NOT OVERRIDE</b> this     * method. Implement the abstract methods instead.     * @pre $none     * @post $none     */    public void body()    {        // register to system GIS first        systemGIS_ = GridSim.getGridInfoServiceEntityId();        int register = GridSimTags.REGISTER_REGIONAL_GIS;        Integer id = new Integer( super.get_id() );        super.send(super.output, GridSimTags.SCHEDULE_NOW, register,                   new IO_data(id, Link.DEFAULT_MTU, systemGIS_) );        // Below method is for a child class to override        registerOtherEntity();        // Process incoming events until END_OF_SIMULATION is received from the        // GridInformationService entity        while ( Sim_system.running() )        {            Sim_event ev = new Sim_event();            super.sim_get_next(ev);     // get the next event in the queue            // if the simulation finishes then exit the loop            if (ev.get_tag() == GridSimTags.END_OF_SIMULATION)            {                processEndSimulation();                break;            }            processEvent(ev);   // process the received event            ev = null;          // reset the event object        }        // remove I/O entities created during construction of this entity        super.terminateIOEntities();    }    /**     * Process an incoming request from users about getting a list of resource     * IDs supporting Advanced Reservation, that are registered in other     * regional GIS entities.     *     * @param ev  a Sim_event object (or an incoming event or request)     * @pre ev != null     * @post $none     */    protected abstract void processGlobalResourceARList(Sim_event ev);    /**     * Process an incoming request from users about getting a list of resource     * IDs, that are registered in other regional GIS entities.     *     * @param ev  a Sim_event object (or an incoming event or request)     * @pre ev != null     * @post $none     */    protected abstract void processGlobalResourceList(Sim_event ev);    /**     * Process an incoming request from users about getting a list of resource     * IDs, that are registered to this regional GIS entity.     *     * @param ev  a Sim_event object (or an incoming event or request)     * @pre ev != null     * @post $none     */    protected abstract void processResourceList(Sim_event ev);    /**     * Process an incoming request from users about getting a list of resource     * IDs supporting Advanced Reservation, that are registered to this     * regional GIS entity.     *     * @param ev  a Sim_event object (or an incoming event or request)     * @pre ev != null     * @post $none     */    protected abstract void processResourceARList(Sim_event ev);    /**     * Process an incoming request from other GIS entities about getting     * a list of resource IDs, that are registered to this regional GIS entity.     *     * @param ev  a Sim_event object (or an incoming event or request)     * @pre ev != null     * @post $none     */    protected abstract void processGISResourceList(Sim_event ev);    /**     * Process an incoming request from other GIS entities about getting     * a list of resource IDs supporting Advanced Reservation,     * that are registered to this regional GIS entity.     *     * @param ev  a Sim_event object (or an incoming event or request)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -