gridsim
Class GridSimShutdown

Object
  |
  +--Thread
        |
        +--eduni.simjava.Sim_entity
              |
              +--gridsim.GridSim
                    |
                    +--gridsim.GridSimShutdown
All Implemented Interfaces:
Runnable

public class GridSimShutdown
extends GridSim

GridimShutdown waits for termination of all user entities to determine the end of simulation.

This class signals the user-defined report-writer entity to interact with the GridStatistics entity to generate a report. Finally, it signals the end of simulation to other GridSim core entities.

This class wraps up the simulation by signaling the END to the entities. It sends END_OF_SIMULATION message to various GridSim entities on receiving END_OF_SIMULATION from all User entities.

Version:
2.1, June 2003
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Field Summary
 
Fields inherited from class gridsim.GridSim
input, output, rand, SimulationStartDate
 
Fields inherited from class eduni.simjava.Sim_entity
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GridSimShutdown(String name, int numUser, String reportWriterName)
          Allocates a new GridSimShutdown object
 
Method Summary
 void body()
          The main method that shuts down resources and Grid Information Service (GIS).
 void shutdownResources()
          Discovers resources and sends END_OF_SIMULATION message to them
 void ShutdownResources()
          Deprecated. As of GridSim 2.1, replaced by shutdownResources()
 
Methods inherited from class gridsim.GridSim
clock, Clock, finalize, finalizeGridSimulation, getEntityId, GetEntityId, getEntityName, GetEntityName, getEntityName, GetEntityName, getGridInfoServiceEntityId, getGridResourceList, GetGridResourceList, getGridSimShutdownEntityId, getGridStatisticsEntityId, getResourceCharacteristics, GetResourceCharacteristics, getResourceDynamicInfo, GetResourceDynamicInformation, getSimulationStartDate, GetSimulationStartDate, GridInformationServiceEntityId, GridletCancel, gridletReceive, GridletReceive, gridletSubmit, GridletSubmit, gridSimHold, GridSimHold, GridSimShutdownEntityId, GridStatisticsEntityId, init, Init, isNetworked, IsNetworked, receiveEventObject, ReceiveEventObject, receiveEventObject, ReceiveEventObject, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, recordStatistics, RecordStatistics, send, Send, send, Send, send, Send, send, Send, send, Send, send, Send, shutdownGridStatisticsEntity, ShutdownGridStatisticsEntity, shutdownUserEntity, ShutdownUserEntity, Start, startGridSimulation, Stop, stopGridSimulation, TerminateInputOutputEntities, terminateIOEntities
 
Methods inherited from class eduni.simjava.Sim_entity
add_param, add_port, get_id, get_name, get_port, get_port, run, send_on, set_invisible, sim_cancel, sim_current, sim_get_next, sim_get_next, sim_hold_for, sim_hold, sim_putback, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_schedule, sim_select, sim_trace, sim_wait_for, sim_wait, sim_waiting, sim_waiting
 
Methods inherited from class Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridSimShutdown

public GridSimShutdown(String name,
                       int numUser,
                       String reportWriterName)
                throws Exception
Allocates a new GridSimShutdown object

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
numUser - number of User entities
reportWriterName - the name of the file to be written
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, String[], String[], String), Sim_entity
Pre Condition:
name != null, numUser >= 0
Post Condition:
$none
Method Detail

ShutdownResources

public void ShutdownResources()
Deprecated. As of GridSim 2.1, replaced by shutdownResources()

Discovers resources and sends END_OF_SIMULATION message to them

Pre Condition:
$none
Post Condition:
$none

shutdownResources

public void shutdownResources()
Discovers resources and sends END_OF_SIMULATION message to them

Pre Condition:
$none
Post Condition:
$none

body

public void body()
The main method that shuts down resources and Grid Information Service (GIS). In addition, this method writes down a report at the end of a simulation based on reportWriterName defined in the Constructor.
NOTE: This method shuts down grid resources and GIS entities AFTER all grid users have been shut down. Therefore, the number of grid users given in the Constructor must be correct. Otherwise, GridSim package hangs forever or it does not terminate properly.

Overrides:
body in class eduni.simjava.Sim_entity
Pre Condition:
$none
Post Condition:
$none