GridSim 5.0 beta

gridsim.datagrid
Class DataGridResource

Object
  extended by Thread
      extended by Sim_entity
          extended by GridSimCore
              extended by GridResource
                  extended by DataGridResource
All Implemented Interfaces:
Cloneable, Runnable

public class DataGridResource
extends GridResource

A resource for Data Grids enables users to run their jobs as well as to gain access to available data sets. A Data Grid resource has the following components:

Since:
GridSim Toolkit 4.0
Author:
Uros Cibej and Anthony Sulistio
See Also:
Storage, ReplicaManager, AbstractRC, AllocPolicy

Nested Class Summary
 
Nested classes/interfaces inherited from class Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class GridResource
policy_, policyType_, regionalGISName_, resCalendar_, resource_, SIZE
 
Fields inherited from class GridSimCore
input, NETWORK_TYPE, output
 
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DataGridResource(String name, Link link, ResourceCharacteristics resource, ResourceCalendar calendar, AllocPolicy policy, ReplicaManager replicaManager)
          Creates a new DataGrid resource object
DataGridResource(String name, Link link, ResourceCharacteristics resource, ResourceCalendar calendar, ReplicaManager replicaManager)
          Creates a new DataGrid resource object
 
Method Summary
 int addFile(File file)
          Adds a file into the resource's storage before the experiment starts.
 boolean addStorage(List storageList)
          Adds one or more Storage elements into the resource.
 boolean addStorage(Storage storage)
          Adds a Storage element
 boolean createLocalRC()
          Creates a new local RC, meaning it is located inside this resource.
 AbstractRC getLocalRC()
          Gets the local RC entity of this resource.
 double getTotalStorageCapacity()
          Gets the total capacity of all Storage elements (in MByte)
 boolean hasLocalRC()
          Checks whether this resource has a local RC entity or not.
protected  void processEndSimulation()
          Notifies internal entities regarding to the end of simulation signal
protected  void processOtherEvent(Sim_event ev)
          Processes events or services that are available for this resource
protected  void registerOtherEntity()
          Registers other entities when a simulation starts.
 boolean setHigherReplicaCatalogue(String rcName)
          Sets the RC name that is located outside this resource.
 boolean setReplicaCatalogue(AbstractRC rc)
          Sets the RC entity for this resource.
 boolean setReplicaCatalogue(String rcName)
          Sets the RC name for this resource.
 boolean setTierLevel(int tierLevel)
          Sets the tier level of this resource (in a hierarchical model)
 
Methods inherited from class GridResource
body, getAllocationPolicy, getResourceCharacteristics, setRegionalGIS, setRegionalGIS
 
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

DataGridResource

public DataGridResource(String name,
                        Link link,
                        ResourceCharacteristics resource,
                        ResourceCalendar calendar,
                        ReplicaManager replicaManager)
                 throws Exception
Creates a new DataGrid resource object

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
link - the link that will be used to connect this resource to another Entity or Router.
resource - an object of ResourceCharacteristics
calendar - an object of ResourceCalendar
replicaManager - a Replica Manager that is responsible for this resource
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
  • the given Replica Manager object is null
  • this entity has zero number of PEs (Processing Elements).
    No PEs mean the Gridlets can't be processed. A resource must contain one or more Machines. A Machine must contain one or more PEs.
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)

DataGridResource

public DataGridResource(String name,
                        Link link,
                        ResourceCharacteristics resource,
                        ResourceCalendar calendar,
                        AllocPolicy policy,
                        ReplicaManager replicaManager)
                 throws Exception
Creates a new DataGrid resource object

Parameters:
name - the name to be associated with this entity (as required by Sim_entity class from simjava package)
link - the link that will be used to connect this resource to another Entity or Router.
resource - an object of ResourceCharacteristics
calendar - an object of ResourceCalendar
policy - a scheduling policy for this Grid resource.
replicaManager - a Replica Manager that is responsible for this resource
Throws:
Exception - This happens when one of the following scenarios occur:
  • creating this entity before initializing GridSim package
  • this entity name is null or empty
  • the given Replica Manager object is null
  • this entity has zero number of PEs (Processing Elements).
    No PEs mean the Gridlets can't be processed. A resource must contain one or more Machines. A Machine must contain one or more PEs.
See Also:
GridSim.init(int, Calendar, boolean, String[], String[], String)
Method Detail

addStorage

public boolean addStorage(List storageList)
Adds one or more Storage elements into the resource.

Parameters:
storageList - a list of Storage elements
Returns:
true if successful, false otherwise
See Also:
Storage

addStorage

public boolean addStorage(Storage storage)
Adds a Storage element

Parameters:
storage - a Storage element
Returns:
true if successful, false otherwise
See Also:
Storage

getTotalStorageCapacity

public double getTotalStorageCapacity()
Gets the total capacity of all Storage elements (in MByte)

Returns:
the total capacity in MB

addFile

public int addFile(File file)
Adds a file into the resource's storage before the experiment starts. If the file is a master file, then it will be registered to the RC when the experiment begins.

Parameters:
file - a DataGrid file
Returns:
a tag number denoting whether this operation is a success or not
See Also:
DataGridTags.FILE_ADD_SUCCESSFUL, DataGridTags.FILE_ADD_ERROR_EMPTY

setHigherReplicaCatalogue

public boolean setHigherReplicaCatalogue(String rcName)
Sets the RC name that is located outside this resource. This method should be used if a local RC exists.

Parameters:
rcName - a RC entity name
Returns:
true if successful, false otherwise

setReplicaCatalogue

public boolean setReplicaCatalogue(String rcName)
Sets the RC name for this resource. This method should be used if a local RC DOES NOT exist.

Parameters:
rcName - a RC entity name
Returns:
true if successful, false otherwise

setReplicaCatalogue

public boolean setReplicaCatalogue(AbstractRC rc)
Sets the RC entity for this resource. This method should be used if a local RC DOES NOT exist.

Parameters:
rc - a RC entity
Returns:
true if successful, false otherwise

createLocalRC

public boolean createLocalRC()
Creates a new local RC, meaning it is located inside this resource. Hence, this local RC is using I/O of the resource. Therefore, to communicate to this local RC, an entity will need to send an event to the resource, then the resource will pass the event to the local RC.

Returns:
true if successful, false otherwise

hasLocalRC

public boolean hasLocalRC()
Checks whether this resource has a local RC entity or not.

Returns:
true if this resource has a local RC entity, false otherwise

getLocalRC

public AbstractRC getLocalRC()
Gets the local RC entity of this resource.

Returns:
the local replica catalogue if it exists, or null otherwise

setTierLevel

public boolean setTierLevel(int tierLevel)
Sets the tier level of this resource (in a hierarchical model)

Parameters:
tierLevel - the tier level of this resource
Returns:
true if successful, false otherwise

processOtherEvent

protected void processOtherEvent(Sim_event ev)
Processes events or services that are available for this resource

Overrides:
processOtherEvent in class GridResource
Parameters:
ev - a Sim_event object

registerOtherEntity

protected void registerOtherEntity()
Registers other entities when a simulation starts. In this case, all master files are being registered by RM to the designated RC.

Overrides:
registerOtherEntity in class GridResource
See Also:
ReplicaManager.registerAllMasterFiles()

processEndSimulation

protected void processEndSimulation()
Notifies internal entities regarding to the end of simulation signal


GridSim 5.0 beta

The University of Melbourne, Australia, 2009