GridSim 5.0 beta

gridsim
Class GridInformationService

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridInformationService
All Implemented Interfaces:
Cloneable, Runnable
Direct Known Subclasses:
DataGIS

public class GridInformationService
extends GridSimCore

A Grid Information Service (GIS) is an entity that provides grid resource registration, indexing and discovery services. The Grid resources tell their readiness to process Gridlets by registering themselves with this entity, done via GridResource.body() method. In addition, GIS is now responsible for notifying all the registered entities, such as GridResource and network entities for shutting down at the end of a simulation. GridSimShutdown entity is not responsible anymore to simplify the overall design, hence coding effort.

Other entities such as the resource broker can contact this class for resource discovery service, which returns a list of registered resource IDs. In summary, it acts like a yellow page service.

This class will be created by GridSim upon initialization of the simulation, i.e. done via GridSim.init(int, Calendar, boolean) method. Hence, do not need to worry about creating an object of this class.

Since GridSim version 3.0, you can create your own GIS entity based on your requirements. Here are the steps needed (see example/Example09 directory for more details):

  1. extends this class
  2. overrides processOtherEvent(Sim_event) method if you want to register other tags apart from GridSimTags.
  3. during initialization of simulation, calls GridSim.init(int, Calendar, boolean, boolean) with gis parameter is set to false.
  4. uses GridSim.setGIS(GridInformationService) method before running or starting the simulation.

NOTE: You do not need to override body() method because this method calls processOtherEvent(Sim_event) for new tags.

Since GridSim version 3.2, this entity is referred as system GIS. If you want to have multiple GIS entities or a regional GIS entity linked as part of a network topology, then you should look at AbstractGIS entity (see examples/RegionalGIS directory for more details).
Therefore, the roles of this system GIS in the overall simulation are:

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya, Anthony Sulistio (re-design this class)
See Also:
GridSimTags, GridSimShutdown, GridSim.init(int, Calendar, boolean), GridSim.init(int, Calendar, boolean, boolean), GridSim.init(int, Calendar, boolean, String[], String[], String), GridSim.setGIS(GridInformationService), GridResource.body()
Invariant:
$none

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class GridSimCore
input, NETWORK_TYPE, output
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GridInformationService(String name, double baud_rate)
          Allocates a new GridInformationService object with networked I/O ports
 
Method Summary
 void body()
          A method that gets one event at a time, and serves it based on its request.
 LinkedList getAdvReservList()
          Gets the list of GridResource IDs that only support Advanced Reservation.
 LinkedList getList()
          Gets the list of all GridResource IDs, including resources that support Advance Reservation.
 boolean isResourceExist(int id)
          Checks whether the given GridResource ID exists or not
 boolean isResourceExist(Integer id)
          Checks whether the given GridResource ID exists or not
protected  void processEndSimulation()
          Notifies the registered entities about the end of simulation.
protected  void processOtherEvent(Sim_event ev)
          This method needs to override by a child class for processing other events.
 boolean resourceSupportAR(int id)
          Checks whether a given resource ID supports Advanced Reservations or not
 boolean resourceSupportAR(Integer id)
          Checks whether a given resource ID supports Advanced Reservations or not
protected  void signalShutdown(Collection list)
          Sends a signal to all entity IDs mentioned in the given list.
 
Methods inherited from class GridSimCore
finalizeGridSimulation, getLink, getPingResult, isNetworked, ping, ping, ping, ping, pingBlockingCall, pingBlockingCall, pingBlockingCall, pingBlockingCall, send, send, send, send, send, send, setBackgroundTraffic, setBackgroundTraffic, terminateIOEntities
 
Methods inherited from class Sim_entity
add_generator, add_param, add_port, clone, get_id, get_name, get_port, get_port, get_stat, run, send_on, set_invisible, set_stat, sim_cancel, sim_completed, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_pause_for, sim_pause_for, sim_pause_until, sim_pause_until, sim_pause, sim_process_for, sim_process_for, sim_process_until, sim_process_until, sim_process, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait_for, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridInformationService

public GridInformationService(String name,
                              double baud_rate)
                       throws Exception
Allocates a new GridInformationService object with networked I/O ports

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
baud_rate - communication speed
Throws:
Exception - This happens when creating this entity before initializing GridSim package or this entity name is null or empty
See Also:
GridSim.init(int, Calendar, boolean), GridSim.init(int, Calendar, boolean, String[], String[], String), Sim_entity
Pre Condition:
name != null, baud_rate > 0.0
Post Condition:
$none
Method Detail

body

public void body()
A method that gets one event at a time, and serves it based on its request. The services or tags available to be processed are:

To process other tags apart from the above, you need to override processOtherEvent(Sim_event) method. You do not need to override this method.

Overrides:
body in class Sim_entity
Pre Condition:
$none
Post Condition:
$none

getList

public LinkedList getList()
Gets the list of all GridResource IDs, including resources that support Advance Reservation.

Returns:
LinkedList containing resource IDs. Each ID is represented by an Integer object.
Pre Condition:
$none
Post Condition:
$none

getAdvReservList

public LinkedList getAdvReservList()
Gets the list of GridResource IDs that only support Advanced Reservation.

Returns:
LinkedList containing resource IDs. Each ID is represented by an Integer object.
Pre Condition:
$none
Post Condition:
$none

resourceSupportAR

public boolean resourceSupportAR(Integer id)
Checks whether a given resource ID supports Advanced Reservations or not

Parameters:
id - a resource ID
Returns:
true if this resource supports Advanced Reservations, false otherwise
Pre Condition:
id != null
Post Condition:
$none

resourceSupportAR

public boolean resourceSupportAR(int id)
Checks whether a given resource ID supports Advanced Reservations or not

Parameters:
id - a resource ID
Returns:
true if this resource supports Advanced Reservations, false otherwise
Pre Condition:
id >= 0
Post Condition:
$none

isResourceExist

public boolean isResourceExist(int id)
Checks whether the given GridResource ID exists or not

Parameters:
id - a GridResource id
Returns:
true if the given ID exists, false otherwise
Pre Condition:
id >= 0
Post Condition:
$none

isResourceExist

public boolean isResourceExist(Integer id)
Checks whether the given GridResource ID exists or not

Parameters:
id - a GridResource id
Returns:
true if the given ID exists, false otherwise
Pre Condition:
id != null
Post Condition:
$none

processOtherEvent

protected void processOtherEvent(Sim_event ev)
This method needs to override by a child class for processing other events. These events are based on tags that are not mentioned in body() method.

Parameters:
ev - a Sim_event object
See Also:
body()
Pre Condition:
ev != null
Post Condition:
$none

processEndSimulation

protected void processEndSimulation()
Notifies the registered entities about the end of simulation. This method should be overriden by the child class


signalShutdown

protected void signalShutdown(Collection list)
Sends a signal to all entity IDs mentioned in the given list.

Parameters:
list - LinkedList storing entity IDs
Pre Condition:
list != null
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009