|
From: <sul...@us...> - 2007-08-27 17:41:31
|
Revision: 30
http://gridsim.svn.sourceforge.net/gridsim/?rev=30&view=rev
Author: sulistio
Date: 2007-08-26 23:22:18 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
clean up the code, fix javadoc comments and minor changes to make this class ready for release.
Modified Paths:
--------------
branches/gridsim4.0-branch1/source/gridsim/resFailure/AllocPolicyWithFailure.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/AvailabilityInfo.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/FailureMsg.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/GridResourceWithFailure.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/RegionalGISWithFailure.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/SpaceSharedWithFailure.java
branches/gridsim4.0-branch1/source/gridsim/resFailure/TimeSharedWithFailure.java
branches/gridsim4.0-branch1/source/gridsim/util/HyperExponential.java
branches/gridsim4.0-branch1/source/gridsim/util/LCGRandom.java
branches/gridsim4.0-branch1/source/gridsim/util/Variate.java
branches/gridsim4.0-branch1/source/gridsim/util/Weibull.java
Added Paths:
-----------
branches/gridsim4.0-branch1/source/gridsim/resFailure/package.html
Modified: branches/gridsim4.0-branch1/source/gridsim/resFailure/AllocPolicyWithFailure.java
===================================================================
--- branches/gridsim4.0-branch1/source/gridsim/resFailure/AllocPolicyWithFailure.java 2007-08-22 08:08:48 UTC (rev 29)
+++ branches/gridsim4.0-branch1/source/gridsim/resFailure/AllocPolicyWithFailure.java 2007-08-27 06:22:18 UTC (rev 30)
@@ -1,3 +1,13 @@
+/*
+ * 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
+ *
+ * Author: Agustin Caminero
+ * Organization: Universidad de Castilla La Mancha (UCLM), Spain.
+ * Created on: Nov 2006.
+ */
package gridsim.resFailure;
@@ -2,5 +12,7 @@
/**
- * The structure of an allocatoin policy supporting resource failure.
- * @author Agustin Caminero, Universidad de Castilla La Mancha (UCLM), Spain. Jan 2007.
- * @since GridSim 4.1
+ * The structure of an allocation policy supporting resource failure.
+ * Use this class in addition to {@link gridsim.AllocPolicy} class.
+ * @author Agustin Caminero
+ * @since GridSim Toolkit 4.1
+ * @see gridsim.AllocPolicy
*/
@@ -10,15 +22,16 @@
public interface AllocPolicyWithFailure
{
/**
- * This function sets the gridlet status of all the gridlets in thos resource to FAILED.
- * Then sends them back to the user, and clean gridlets lists.*/
+ * Sets the status of all Gridlets in this resource to <tt>FAILED</tt>.
+ * Then sends them back to users, and clean up the relevant lists.
+ */
public abstract void setGridletsFailed();
/**
- * This function sets the gridlet status of all the gridlets in a machine to FAILED.
- * Then sends them back to the user, and clean gridlets lists.
- * @param failedMachID the id of the failed machine */
+ * Sets the status of all Gridlets in this machine to <tt>FAILED</tt>.
+ * Then sends them back to users, and clean up the relevant lists.
+ * @param failedMachID the id of the failed machine
+ */
public abstract void setGridletsFailed(int failedMachID);
} // end class
-
Modified: branches/gridsim4.0-branch1/source/gridsim/resFailure/AvailabilityInfo.java
===================================================================
--- branches/gridsim4.0-branch1/source/gridsim/resFailure/AvailabilityInfo.java 2007-08-22 08:08:48 UTC (rev 29)
+++ branches/gridsim4.0-branch1/source/gridsim/resFailure/AvailabilityInfo.java 2007-08-27 06:22:18 UTC (rev 30)
@@ -1,66 +1,89 @@
/*
- * Agustin Caminero
- * Instituto de Investigacion en Informatica de Albacete
- * Universidad de Castilla La Mancha, Spain
- * January, 2007.
+ * 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
*
- * This class implements the way that users know if a resource is working or is totally failed.
- *
+ * Author: Agustin Caminero
+ * Organization: Universidad de Castilla La Mancha (UCLM), Spain.
+ * Created on: Nov 2006.
*/
package gridsim.resFailure;
/**
- * This class implements the way that users know if a resource is working or is totally failed.
- * @author Agustin Caminero, Universidad de Castilla La Mancha (UCLM), Spain. Jan 2007.
- * @since GridSim 4.1
+ * This class is used by GridSim users to check whether a particular resource
+ * is working or is totally failed.
+ *
+ * @author Agustin Caminero
+ * @since GridSim Toolkit 4.1
*/
public class AvailabilityInfo
{
+ private int resID;
+ private int srcID;
+ private boolean availability;
- public int resID;
- public int srcID;
- public boolean availability;
-
+ /**
+ * Creates a new object of this class
+ * @param res a resource id
+ * @param src the sender id
+ */
public AvailabilityInfo(int res, int src)
{
resID = res;
srcID = src;
- availability = true; // by default, true
+ availability = true; // by default, true
}
- public int getSrcID()
- {
+ /**
+ * Gets the source or sender id
+ * @return sender id
+ */
+ public int getSrcID() {
return srcID;
}
- public int getResID()
- {
+ /**
+ * Gets the resource id
+ * @return resource id
+ */
+ public int getResID() {
return resID;
}
- public boolean getAvailability()
- {
+ /**
+ * Checks the availability of this resource
+ * @return <tt>true</tt> if available, <tt>false</tt> otherwise
+ */
+ public boolean getAvailability() {
return availability;
}
- public void setSrcID(int src)
- {
+ /**
+ * Sets the source or sender id
+ * @param src the sender id
+ */
+ public void setSrcID(int src) {
srcID = src;
}
- public void setResID(int res)
- {
+ /**
+ * Sets the resource id
+ * @param res a resource id
+ */
+ public void setResID(int res) {
resID = res;
}
- public void setAvailability(boolean av)
- {
+ /**
+ * Sets the resource availability
+ * @param av <tt>true</tt> if available, <tt>false</tt> otherwise
+ */
+ public void setAvailability(boolean av) {
availability = av;
}
-
-
-}
+} // end class
Modified: branches/gridsim4.0-branch1/source/gridsim/resFailure/FailureMsg.java
===================================================================
--- branches/gridsim4.0-branch1/source/gridsim/resFailure/FailureMsg.java 2007-08-22 08:08:48 UTC (rev 29)
+++ branches/gridsim4.0-branch1/source/gridsim/resFailure/FailureMsg.java 2007-08-27 06:22:18 UTC (rev 30)
@@ -1,81 +1,103 @@
/*
- * Agustin Caminero
- * Instituto de Investigacion en Informatica de Albacete
- * Universidad de Castilla La Mancha, Spain
- * November, 2006.
+ * 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
*
- * This class implements the way that the (Regional)GIS commnunicates with the
- * GridResources to simulate a resource failure.
- *
+ * Author: Agustin Caminero
+ * Organization: Universidad de Castilla La Mancha (UCLM), Spain.
+ * Created on: Nov 2006.
*/
package gridsim.resFailure;
/**
- * This class implements the way that the RegionalGISWithFailure commnunicates with the
- * GridResourcesWithFailure to simulate a resource failure.
- * @author Agustin Caminero, Universidad de Castilla La Mancha (UCLM), Spain. Jan 2007.
- * @since GridSim 4.1
+ * This class is used by
+ * {@link gridsim.resFailure.RegionalGISWithFailure} to commnunicate with
+ * {@link gridsim.resFailure.GridResourceWithFailure}
+ * for simulating a resource failure.
+ *
+ * @author Agustin Caminero
+ * @since GridSim Toolkit 4.1
*/
-public class FailureMsg {
- /**The time that the failure will last*/
- double time;
+public class FailureMsg
+{
+ /** The time that the failure will last */
+ private double time;
- /**The id of the resource*/
- int res_id;
+ /** The id of the resource */
+ private int res_id;
- /**The number of machines that will fail in this resource*/
- int numMachines;
+ /** The number of machines that will fail in this resource */
+ private int numMachines;
- /**@param t the time that the failure will last
- * @param rid the resource id */
- public FailureMsg(double t, int rid) {
- time = t;
+ /**
+ * Creates a new failure message
+ * @param time the time that the failure will last
+ * @param rid the resource id
+ */
+ public FailureMsg(double time, int rid) {
+ this.time = time;
res_id = rid;
numMachines = 0;
}
- /**This method sets the time atribute of the ResourceFailure object
- * @param t the time that the failure will last*/
- public void setTime(double t)
+ /**
+ * This method sets the time atribute of the ResourceFailure object
+ * @param time the time that the failure will last
+ */
+ public void setTime(double time)
{
- time = t;
+ this.time = time;
}
- /**This method returns the time atribute of the ResourceFailure object */
+ /**
+ * This method returns the time atribute of the ResourceFailure object
+ * @return time
+ */
public double getTime()
{
return time;
}
- /**This method sets the res_id atribute of the ResourceFailure object
- * @param r the resource id of the resource*/
+ /**
+ * This method sets the res_id atribute of the ResourceFailure object
+ * @param r the resource id of the resource
+ */
public void setRes(int r)
{
res_id = r;
}
- /**This method returns the res_id atribute of the ResourceFailure object */
+ /**
+ * This method returns the res_id atribute of the ResourceFailure object
+ * @return the resource id
+ */
public int getRes()
{
return res_id;
}
- /**This method sets the numMachines atribute of the ResourceFailure object
- * @param n the number of machines which will fail in this resource*/
+ /**
+ * This method sets the numMachines atribute of the ResourceFailure object
+ * @param n the number of machines which will fail in this resource
+ */
public void setNumMachines(int n)
{
numMachines = n;
}
- /**This method returns the number of machines which will fail in this resource */
+ /**
+ * This method returns the number of machines which will fail
+ * in this resource
+ * @return number of failed machines
+ */
public double getNumMachines()
{
return numMachines;
}
-
-}
+} // end class
Modified: branches/gridsim4.0-branch1/source/gridsim/resFailure/GridResourceWithFailure.java
===================================================================
--- branches/gridsim4.0-branch1/source/gridsim/resFailure/GridResourceWithFailure.java 2007-08-22 08:08:48 UTC (rev 29)
+++ branches/gridsim4.0-branch1/source/gridsim/resFailure/GridResourceWithFailure.java 2007-08-27 06:22:18 UTC (rev 30)
@@ -23,32 +23,23 @@
/**
- * TODO: write a proper class decription
- * Based on existing GridResource class.
+ * GridResourceWithFailure is based on {@link gridsim.GridResource}, but with
+ * added failure functionalities.
+ * GridResourceWithFailure extends the {@link gridsim.GridSimCore} class for
+ * gaining communication and concurrent entity capabilities.
+ * An instance of this class stimulates a resource
+ * with properties defined in an object of
+ * {@link gridsim.ResourceCharacteristics} class.
*
* @author Agustin Caminero
- * Things added or modified:
- * - RESOURCE_NUM_MACHINES event
- * - processEvent(...)
- * - processFailure(...)
- * - processRecovery(...)
- * - setMachineFailed(...)
- * - processPingRequest(...) -> it's not modifyed any more
- * - processPolling(...)
- *
- *
* @since GridSim Toolkit 4.1
- * @see gridsim.GridSimCore
+ * @see gridsim.GridResource
* @see gridsim.ResourceCharacteristics
- * @see gridsim.AllocPolicyWithFailure
+ * @see gridsim.resFailure.AllocPolicyWithFailure
* @invariant $none
*/
public class GridResourceWithFailure extends GridSimCore
{
-
- /**Wether this resource is working properly or it is failed*/
- //private boolean ResourceFailed_;
-
/** Characteristics of this resource */
protected ResourceCharacteristics resource_;
@@ -69,10 +60,13 @@
/** Regional GIS entity name */
protected String regionalGISName_;
+ // a flag to denote whether to record events into a file or not
+ private boolean record_ = false;
+
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use
* {@link #GridResourceWithFailure(String, double, ResourceCharacteristics,
* ResourceCalendar, AllocPolicyWithFailure)}
* and then overrides {@link #processOtherEvent(Sim_event)}.
@@ -101,7 +95,7 @@
* String)
* @see gridsim.GridSim#init(int, Calendar, boolean)
* @see #GridResourceWithFailure(String, double,
- * ResourceCharacteristics, ResourceCalendar, AllocPolicyWithFailure)
+ * ResourceCharacteristics, ResourceCalendar, AllocPolicyWithFailure)
* @pre name != null
* @pre baud_rate > 0
* @pre resource != null
@@ -125,8 +119,8 @@
}
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use
* {@link #GridResourceWithFailure(String, double, ResourceCharacteristics,
* ResourceCalendar, AllocPolicyWithFailure)}
* and then overrides {@link #processOtherEvent(Sim_event)}.
@@ -150,7 +144,7 @@
* String)
* @see gridsim.GridSim#init(int, Calendar, boolean)
* @see #GridResourceWithFailure(String, double,
- * ResourceCharacteristics, ResourceCalendar, AllocPolicyWithFailure)
+ * ResourceCharacteristics, ResourceCalendar, AllocPolicyWithFailure)
* @pre name != null
* @pre baud_rate > 0
* @pre resource != null
@@ -170,9 +164,9 @@
}
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use this constructor and then overrides
- * {@link #processOtherEvent(Sim_event)}.
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use this constructor and then
+ * overrides {@link #processOtherEvent(Sim_event)}.
*
* @param name the name to be associated with this entity (as
* required by Sim_entity class from simjava package)
@@ -195,7 +189,7 @@
* @see gridsim.GridSim#init(int, Calendar, boolean, String[], String[],
* String)
* @see gridsim.GridSim#init(int, Calendar, boolean)
- * @see gridsim.AllocPolicyWithFailure
+ * @see gridsim.resFailure.AllocPolicyWithFailure
* @pre name != null
* @pre baud_rate > 0
* @pre resource != null
@@ -209,17 +203,18 @@
{
super(name, baud_rate);
resource_ = resource;
-
resCalendar_ = calendar;
- policy_ = (AllocPolicy) policy; // the order between policy and init() is important
+
+ // the order between policy and init() is important
+ policy_ = (AllocPolicy) policy;
init();
}
////////////////////////////////////////////
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use
* {@link #GridResourceWithFailure(String, Link, ResourceCharacteristics,
* ResourceCalendar, AllocPolicyWithFailure)}
* and then overrides {@link #processOtherEvent(Sim_event)}.
@@ -252,7 +247,7 @@
* @pre resource != null
* @post $none
*/
- public GridResourceWithFailure(String name, Link link, long seed,
+ public GridResourceWithFailure(String name, Link link, long seed,
ResourceCharacteristics resource, double peakLoad,
double offPeakLoad, double relativeHolidayLoad,
LinkedList weekends, LinkedList holidays) throws Exception
@@ -269,8 +264,8 @@
}
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use
* {@link #GridResourceWithFailure(String, Link, ResourceCharacteristics,
* ResourceCalendar, AllocPolicyWithFailure)}
* and then overrides {@link #processOtherEvent(Sim_event)}.
@@ -312,9 +307,9 @@
}
/**
- * Allocates a new GridResourceWithFailure object. When making a different type of
- * GridResourceWithFailure object, use this constructor and then overrides
- * {@link #processOtherEvent(Sim_event)}.
+ * Allocates a new GridResourceWithFailure object. When making a different
+ * type of GridResourceWithFailure object, use this constructor and then
+ * overrides {@link #processOtherEvent(Sim_event)}.
*
* @param name the name to be associated with this entity (as
* required by Sim_entity class from simjava package)
@@ -337,7 +332,7 @@
* </ul>
* @see gridsim.GridSim#init(int, Calendar, boolean, String[], String[],
* String)
- * @see gridsim.AllocPolicyWithFailure
+ * @see gridsim.resFailure.AllocPolicyWithFailure
* @pre name != null
* @pre link != null
* @pre resource != null
@@ -347,13 +342,14 @@
*/
public GridResourceWithFailure(String name, Link link,
ResourceCharacteristics resource, ResourceCalendar calendar,
- AllocPolicy policy) throws Exception
+ AllocPolicyWithFailure policy) throws Exception
{
super(name,link);
resource_ = resource;
-
resCalendar_ = calendar;
- policy_ = policy; // the order between policy and init() is important
+
+ // the order between policy and init() is important
+ policy_ = (AllocPolicy) policy;
init();
}
@@ -399,9 +395,19 @@
}
/**
- * Handles external events that are coming to this GridResourceWithFailure entity.
- * This method also registers the identity of this GridResourceWithFailure entity to
- * <tt>GridInformationService</tt> class.
+ * Asks this resource to record its activities. <br>
+ * NOTE: this method should be called <b>BEFORE</b> the ssimulation starts.
+ * @param trace <tt>true</tt> if you want to record this resource's
+ * activities, <tt>false</tt> otherwise
+ */
+ public void setTrace(boolean trace) {
+ record_ = trace;
+ }
+
+ /**
+ * Handles external events that are coming to this GridResourceWithFailure
+ * entity. This method also registers the identity of this
+ * GridResourceWithFailure entity to <tt>GridInformationService</tt> class.
* <p>
* The services or tags available for this resource are:
* <ul>
@@ -460,7 +466,7 @@
registerOtherEntity();
// Put the headers on each column in the results file
- initializeResultsFile();
+ initializeReportFile();
// Process events until END_OF_SIMULATION is received from the
// GridSimShutdown Entity
@@ -472,7 +478,7 @@
// if the simulation finishes then exit the loop
if (ev.get_tag() == GridSimTags.END_OF_SIMULATION)
{
- System.out.println(get_name()+ ". Processing end of simulation...");
+ System.out.println(get_name()+ ": end of simulation...");
policy_.setEndSimulation();
break;
}
@@ -485,35 +491,7 @@
super.terminateIOEntities();
}
- /**
- * As of GridSim 2.2, this method is <b>OBSOLETE</b>.
- * Allocates one of the PEs to Gridlet for execution and schedules
- * an internal event to be delivered at completion time.
- * @param gl a Gridlet to be processed
- * @deprecated As of GridSim 2.2, this method is <b>OBSOLETE</b>.
- * @pre gl != null
- * @post $none
- */
- public void SpaceShare_AllocatePEtoGridlet(Gridlet gl) {
- this.spaceShared_AllocatePEtoGridlet(gl);
- }
- /**
- * As of GridSim 2.2, this method is <b>OBSOLETE</b>.
- * Allocates one of the PEs to Gridlet for execution and schedules
- * an internal event to be delivered at completion time.
- * @param gl a Gridlet to be processed
- * @deprecated As of GridSim 2.2, this method is <b>OBSOLETE</b>.
- * @pre gl != null
- * @post $none
- */
- public void spaceShared_AllocatePEtoGridlet(Gridlet gl)
- {
- System.out.println("GridResourceWithFailure.spaceShared_AllocatePEtoGridlet()" +
- " is OBSOLETE since GridSim 2.2. Don't use this method.");
- }
-
-
//////////////////// PROTECTED METHODS ///////////////////////////////////
/**
@@ -521,7 +499,7 @@
* This method is called by {@link #body()} for incoming unknown tags.
* <p>
* Another approach is to override the
- * {@link gridsim.AllocPolicyWithFailure#processOtherEvent(Sim_event)} method.
+ * {@link gridsim.AllocPolicy#processOtherEvent(Sim_event)} method.
* This approach is desirable if you do not want to create a new type of
* grid resource.
*
@@ -606,10 +584,12 @@
}
policy_.init(resource_, resCalendar_, super.output);
+ record_ = false;
}
/**
- * Processes events or services that are available for this GridResourceWithFailure
+ * Processes events or services that are available for this
+ * GridResourceWithFailure
* @param ev a Sim_event object
* @pre ev != null
* @post $none
@@ -618,7 +598,8 @@
{
int src_id = -1;
- // GRIDRESOURCE_RECOVERY and GRIDRESOURCE_FAILURE_INFO (polling request) are ALWAYS processed.
+ // GRIDRESOURCE_RECOVERY and GRIDRESOURCE_FAILURE_INFO (polling request)
+ // are ALWAYS processed.
if (ev.get_tag() == GridSimTags.GRIDRESOURCE_RECOVERY)
{
processRecovery(ev);
@@ -628,7 +609,8 @@
processPolling(ev);
}
- if (getResourceFailed() == false) // Only if the resource is not failed, then process other events
+ // Only if the resource is not failed, then process other events
+ if (getResourceFailed() == false)
{
switch (ev.get_tag())
{
@@ -637,7 +619,7 @@
case GridSimTags.RESOURCE_CHARACTERISTICS:
src_id = ((Integer) ev.get_data()).intValue();
super.send(super.output, 0.0, ev.get_tag(),
- new IO_data(resource_, resource_.getByteSize(), src_id));
+ new IO_data(resource_, resource_.getByteSize(), src_id));
break;
@@ -660,7 +642,7 @@
src_id = ((Integer) ev.get_data()).intValue();
int numFreePE = resource_.getNumFreePE();
super.send(super.output, 0.0, ev.get_tag(),
- new IO_data(new Integer(numFreePE), SIZE, src_id));
+ new IO_data(new Integer(numFreePE), SIZE, src_id));
break;
// New Gridlet arrives
@@ -700,12 +682,12 @@
processGridlet(ev, GridSimTags.GRIDLET_RESUME_ACK);
break;
- // Moves a previously submitted Gridlet to a different resource
+ // Moves a previously submitted Gridlet to a different res
case GridSimTags.GRIDLET_MOVE:
processGridletMove(ev, GridSimTags.GRIDLET_MOVE);
break;
- // Moves a previously submitted Gridlet to a different resource
+ // Moves a previously submitted Gridlet to a different res
case GridSimTags.GRIDLET_MOVE_ACK:
processGridletMove(ev, GridSimTags.GRIDLET_MOVE_ACK);
break;
@@ -725,7 +707,7 @@
break;
case GridSimTags.GRIDRESOURCE_RECOVERY:
- // Do nothing, as we have already done it in the "if" statement
+ // Do nothing, as we have done it in the "if" statement
break;
// Get the total number of machines of this resource
@@ -733,12 +715,13 @@
src_id = ((Integer) ev.get_data()).intValue();
int numMachines = resource_.getNumMachines();
super.send(super.output, 0.0, ev.get_tag(),
- new IO_data(new Integer(numMachines), SIZE, src_id));
+ new IO_data(new Integer(numMachines), SIZE, src_id));
break;
case GridSimTags.GRIDRESOURCE_FAILURE_INFO:
- // Do nothing, as we have already done it in the "if" statement
+ // Do nothing, as we have done it in the "if" statement
break;
+
// other unknown tags are processed by this method
default:
processOtherEvent(ev);
@@ -747,7 +730,8 @@
}// if (getResourceFailed() == false)
else
{
- // If we receive an event while the resource is out of order, we have to send the event back.
+ // If we receive an event while the resource is out of order,
+ // we have to send the event back.
// Otherwise the sender of that event would get stuck.
Object obj = ev.get_data();
@@ -757,19 +741,18 @@
try
{
gl.setGridletStatus(Gridlet.FAILED_RESOURCE_UNAVAILABLE);
-
gl.setResourceParameter(super.get_id(), resource_.getCostPerSec());
}catch(Exception e) {}
- /*
+ /*********
//Uncomment this, if you want more info on the progress of sims
System.out.println("################# " + super.get_name() +
- ". Received an event from " + GridSim.getEntityName(gl.getUserID()) +
- " while the resource was failed. So, event not processed. Event tag: " +
- ev.get_tag() +
- ". Returning GRIDLET_RETURN to the user.");
- */
+ ". Received an event from " + GridSim.getEntityName(gl.getUserID()) +
+ " while the resource was failed. So, event not processed. Event tag: " +
+ ev.get_tag() +
+ ". Returning GRIDLET_RETURN to the user.");
+ *******/
super.send(super.output, 0, GridSimTags.GRIDLET_RETURN,
new IO_data(gl,gl.getGridletOutputSize(),gl.getUserID()) );
@@ -783,13 +766,9 @@
src_id = ((Integer) ev.get_data()).intValue();
super.send(super.output, 0.0, ev.get_tag(),
- new IO_data(resource_, resource_.getByteSize(), src_id));
+ new IO_data(resource_, resource_.getByteSize(), src_id));
}
-
-
}
-
-
}
/**
@@ -1040,6 +1019,7 @@
new IO_data(pkt, pkt.getSize(), pkt.getSrcID()));
}
+ ////////////////////////////////////////////
/**
* Processes a polling request.
@@ -1052,33 +1032,32 @@
// The resource WILL ALWAYS give a response to the polling requests,
// even when all the machines of the resource are out of order.
// When all the machines are out of order,
- // the resource will wait for a period of time before answering the polling request.
+ // the resource will wait for a period of time before answering
+ // the polling request.
AvailabilityInfo resAv = (AvailabilityInfo) ev.get_data();
- /*// Uncomment this to get more info on the progress of sims
+ /****** // Uncomment this to get more info on the progress of sims
System.out.println("++++++++++ " + super.get_name() +
- ". Received a poll request event from "+
- GridSim.getEntityName(resAv.getSrcID()) +". Clock: " +
- GridSim.clock() +". Is res failed?: "+ getResourceFailed());*/
+ ". Received a poll request event from "+
+ GridSim.getEntityName(resAv.getSrcID()) +". Clock: " +
+ GridSim.clock() +". Is res failed?: "+ getResourceFailed());
+ *******/
-
- if (getResourceFailed()) // if all the mahcines of the resource are out of order or not
+ // if all the mahcines of the resource are out of order or not
+ if (getResourceFailed())
{
resAv.setAvailability(false);
-
super.sim_pause(GridSimTags.POLLING_TIME_USER);
-
}
else
{
resAv.setAvailability(true);
-
}
+
// sends back to the sender
super.send(super.output, 0.0, ev.get_tag(),
new IO_data(resAv, Link.DEFAULT_MTU, resAv.getSrcID()));
-
}
@@ -1088,7 +1067,7 @@
* @pre ev != null
* @post $none
*/
- protected void processFailure(Sim_event ev)
+ private void processFailure(Sim_event ev)
{
if (ev == null)
{
@@ -1096,64 +1075,73 @@
"Error - an event is null.");
return;
}
+
Object obj = ev.get_data();
if (obj instanceof FailureMsg)
{
-
- //FileWriter fwriter = null;
-
FailureMsg resFail = (FailureMsg) obj;
int numFailedMachines = (int)resFail.getNumMachines();
int numMachines = resource_.getNumMachines();
- // First, we have to set ome of the machines of the resource as out of order.
- // Then, we have to set the gridlets to FAILED or FAILED_RESOURCE_UNAVAILABLE
- // depending on whether there are still available machines in this resource
+ // First, we have to set ome of the machines of the resource
+ // as out of order.
+ // Then, we have to set the gridlets to FAILED or
+ // FAILED_RESOURCE_UNAVAILABLE
+ // depending on whether there are still available machines
+ // in this resource
if (numFailedMachines >= numMachines)
{
- // This resource will not work, as none of its machines are running
-
-
-
+ // This resource will not work, as none of its machines
+ // are running
double time;
time = resFail.getTime();
- // Uncomment this if you want more info on the progress of sims
- System.out.println("################# " + super.get_name() +
- ".processFailure(): " +
- "Received an event GRIDRESOURCE_FAILURE. Clock:" +
- GridSim.clock() +
- " which will last until clock:" +
- (GridSim.clock() + time) +
- ". There are NO working machines in this resource.");
+ /*****************/
+ // Now, we keep the moment of the failure in a results file
+ // for this res
+ if (record_ == true) {
+ write("Failure", numMachines);
+ System.out.println("################# " + super.get_name() +
+ ".processFailure(): " +
+ "Received an event GRIDRESOURCE_FAILURE. Clock:" +
+ GridSim.clock() + " which will last until clock:" +
+ (GridSim.clock() + time) +
+ ". There are NO working machines in this resource.");
+ }
+ /******************/
- setMachineFailed(true, numMachines); // set all the machines as failed
-
+ // set all the machines as failed
+ setMachineFailed(true, numMachines);
emptyGridletLists();
- // as all the machines in this resource have failed, all the gridlets
- // are lost (the ones running and the ones waiting)
- // Now, we keep the moment of the failure in a results file for this res
- write ("Failure", numMachines);
+ // as all the machines in this resource have failed, all
+ // gridlets are lost (the ones running and the ones waiting)
}//if (numFailedMachines >= numMachines)
else
{
- // This resource will still work, as some of its machines are running
+ // This resource will still work, as some of its machines
+ // are running
+ /*****************/
+ // Now, we keep the moment of the failure in a results file
+ // for this res
+ if (record_ == true) {
+ write("Failure", numFailedMachines);
- // Uncomment this if you want more info on the progress of sims
- System.out.println("################# " + super.get_name() +
- ".processFailure(): " +
- "Received an event GRIDRESOURCE_FAILURE. Clock:" +
- GridSim.clock() +
- ". There are STILL working machines in this resource.");
+ System.out.println("################# " + super.get_name() +
+ ".processFailure(): " +
+ "Received an event GRIDRESOURCE_FAILURE. Clock:" +
+ GridSim.clock() +
+ ". There are STILL working machines in this resource.");
+ }
+ /******************/
+ // set numFailedMachines machines as failed
+ setMachineFailed(true, numFailedMachines);
- setMachineFailed(true, numFailedMachines); // set numFailedMachines machines as failed
-
Machine mach;
int machID;
// empty only the exec list of the machines which has failed
@@ -1163,14 +1151,8 @@
machID = mach.getMachineID();
emptyGridletLists(machID);
}
-
- // Now, we keep the moment of the failure in a results file for this res
- write ("Failure", numFailedMachines);
-
}
-
}
-
}
/**
@@ -1181,7 +1163,7 @@
* @pre ev != null
* @post $none
*/
- protected void processRecovery(Sim_event ev)
+ private void processRecovery(Sim_event ev)
{
int mach = resource_.getNumMachines();
int failedMach = resource_.getNumFailedMachines();
@@ -1198,30 +1180,34 @@
int gisID = GridSim.getEntityId(regionalGISName_);
// send the registration to regGIS
- super.send(super.output, GridSimTags.SCHEDULE_NOW, GridSimTags.REGISTER_RESOURCE,
+ super.send(super.output, GridSimTags.SCHEDULE_NOW,
+ GridSimTags.REGISTER_RESOURCE,
new IO_data(new Integer(super.get_id()), SIZE, gisID));
System.out.println(super.get_name() + ": Resource recovered." +
- " Registering the resource at the regional GIS AGAIN" +
- " after the failure at clock:" + GridSim.clock());
+ " Registering the resource at the regional GIS AGAIN" +
+ " after the failure at clock:" + GridSim.clock());
}
- else
- System.out.println(super.get_name() + ": Resource recovered at clock:" + GridSim.clock());
+ else {
+ System.out.println(super.get_name() +
+ ": Resource recovered at clock:" + GridSim.clock());
+ }
-
- write("Recovery", 0);// Write in the results file
-
+ if (record_ == true) {
+ write("Recovery", 0); // Write in the results file
+ }
}
/**
- * This method empties the lists containing gridlets in execution and waiting for execution.
+ * This method empties the lists containing gridlets in execution
+ * and waiting for execution.
*/
- protected void emptyGridletLists()
+ private void emptyGridletLists()
{
if (policy_ instanceof AllocPolicyWithFailure)
- ((AllocPolicyWithFailure)policy_).setGridletsFailed();
+ ((AllocPolicyWithFailure) policy_).setGridletsFailed();
}
@@ -1232,18 +1218,20 @@
* @pre ev != null
* @post $none
*/
- protected void emptyGridletLists(int machID)
+ private void emptyGridletLists(int machID)
{
if (policy_ instanceof AllocPolicyWithFailure)
- ((AllocPolicyWithFailure)policy_).setGridletsFailed(machID);
+ ((AllocPolicyWithFailure) policy_).setGridletsFailed(machID);
}
/**
- * Returns true if all the machines of the resource are out of order at this moment.
+ * Checks whether all machines in this resource are failed or not.
+ * @return <tt>true</tt> if all the machines of the resource
+ * are out of order at this moment.
*/
- public boolean getResourceFailed()
+ private boolean getResourceFailed()
{
int numMach = resource_.getMachineList().size();
Machine mach;
@@ -1260,121 +1248,129 @@
return resFailed;
}
- /**Set the status of a machine of this resource.
- * @param b the new status of the machine. true means the machine is failed, false means the machine is working properly.
- * @param numFailedMachines the number of mahicnes whose status were are going to modify
+ /**
+ * Set the status of a machine of this resource.
+ * @param b the new status of the machine.
+ * <tt>true</tt> means the machine is failed,
+ * <tt>false</tt> means the machine is working properly.
+ * @param numFailedMachines the number of failed machines
*
- * */
- public void setMachineFailed(boolean b, int numFailedMachines)
+ */
+ private void setMachineFailed(boolean b, int numFailedMachines)
{
Machine mach;
- /*
- // Uncomment htis if you want more info on the progress of sims
- String status = null;
+ /************
+ // Uncomment this if you want more info on the progress of sims
+ String status = null;
if (b)
status = "FAILED";
else
- status = "WORKING";*/
+ status = "WORKING";
+ ************/
- for(int i=0; i< numFailedMachines; i++)
+ for(int i = 0; i < numFailedMachines; i++)
{
mach = resource_.getMachineList().getMachineInPos(i);
-
if (mach != null)
{
+ /*************
// Uncomment htis if you want more info on the progress of sims
- //System.out.println("$$$$$$ "+ super.get_name() +". Machine: "+ i +": Setting this machine to "+ status+ "...");
- //mach.setFailed(super.get_name(), i, b);
- mach.setFailed(super.get_name(), b);
+ System.out.println("$$$$$$ "+ super.get_name() +". Machine: "
+ + i +": Setting this machine to "+ status+ "...");
+ mach.setFailed(super.get_name(), i, b);
+ *************/
+ mach.setFailed(super.get_name(), b);
}
}
}
- /**
- * Initialize the results files (put headers over each column)
- * */
- public void initializeResultsFile()
+ /**
+ * Initializes the results files (put headers over each column)
+ */
+ private void initializeReportFile()
{
- // Initialize the results file
- FileWriter fwriter = null;
- try
- {
- fwriter = new FileWriter(super.get_name(), true);
+ if (record_ == false) {
+ return;
+ }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- System.out.println(
- "Unwanted errors while opening file " + super.get_name()+" or " + super.get_name()+"_Fin");
- }
+ // Initialize the results file
+ FileWriter fwriter = null;
+ try {
+ fwriter = new FileWriter(super.get_name(), true);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Unwanted errors while opening file " +
+ super.get_name() + " or " + super.get_name() + "_Fin");
+ }
- try
- {
- fwriter.write(
- "Resource \t Event \t NumMachines \t Clock\n");
+ try {
+ fwriter.write("Resource \t Event \t NumMachines \t Clock\n");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Unwanted errors while writing on file " +
+ super.get_name() + " or " + super.get_name() + "_Fin");
+ }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- System.out.println(
- "Unwanted errors while writing on file " + super.get_name()+" or " + super.get_name()+"_Fin");
- }
-
- try
- {
- fwriter.close();
-
- } catch (Exception ex)
- {
- ex.printStackTrace();
- System.out.println(
- "Unwanted errors while closing file " + super.get_name()+" or " + super.get_name()+"_Fin");
- }
+ try {
+ fwriter.close();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ System.out.println("Unwanted errors while closing file " +
+ super.get_name() + " or " + super.get_name() + "_Fin");
+ }
}
/**
- * Write some data into a results file.
- * @param event Values: "Failure" or "Recovery" a gridlet
- * */
- public void write(String event, int numMachines)
+ * Writes some data into a results file.
+ * @param event Values: "Failure" or "Recovery" of a resource
+ * @param numMachiens number of machines
+ */
+ private void write(String event, int numMachines)
{
- // Write into a results file
- // Now, we keep the moment of the failure in a results file for this res
- FileWriter fwriter = null;
- try
- {
+ if (record_ == false) {
+ return;
+ }
+
+ // Write into a results file
+ // Now, we keep the moment of the failure in a results file for this res
+ FileWriter fwriter = null;
+ try
+ {
fwriter = new FileWriter(this.get_name(), true);
- } catch (Exception ex)
- {
+ } catch (Exception ex)
+ {
ex.printStackTrace();
System.out.println("Unwanted errors while opening file " +
this.get_name());
- }
- try
- {
- fwriter.write(this.get_name() + "\t "+event+ " \t" + numMachines +" \t" + GridSim.clock() + "\n");
- } catch (Exception ex)
- {
+ }
+ try
+ {
+ fwriter.write(this.get_name() + "\t " + event+ " \t" + numMachines +
+ " \t" + GridSim.clock() + "\n");
+ } catch (Exception ex)
+ {
ex.printStackTrace();
System.out.println("Unwanted errors while writing on file " +
this.get_name());
- }
+ }
- try
- {
+ try
+ {
fwriter.close();
- } catch (Exception ex)
- {
+ } catch (Exception ex)
+ {
ex.printStackTrace();
System.out.println("Unwanted errors while closing file " +
this.get_name());
- }
-
+ }
}
-
-
} // end class
-
Modified: branches/gridsim4.0-branch1/source/gridsim/resFailure/RegionalGISWithFailure.java
===================================================================
--- branches/gridsim4.0-branch1/source/gridsim/resFailure/RegionalGISWithFailure.java 2007-08-22 08:08:48 UTC (rev 29)
+++ branches/gridsim4.0-branch1/source/gridsim/resFailure/RegionalGISWithFailure.java 2007-08-27 06:22:18 UTC (rev 30)
@@ -2,7 +2,12 @@
* 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
+ *
+ * Author: Agustin Caminero
+ * Organization: Universidad de Castilla La Mancha (UCLM), Spain.
+ * Created on: Nov 2006.
+ */
package gridsim.resFailure;
@@ -15,13 +20,15 @@
import gridsim.resFailure.FailureMsg;
import eduni.simjava.distributions.DiscreteGenerator;
import eduni.simjava.distributions.ContinuousGenerator;
-//import gridsim.resFailure.distributions.Variate;
import gridsim.util.Variate;
import java.io.FileWriter;
/**
- * RegionalGISWithFailureis a simple regional GridInformationService (GIS) entity that
+ * RegionalGISWithFailure is based on {@link gridsim.index.RegionalGIS}, but
+ * with added failure functionalities.
+ * RegionalGISWithFailure is a simple regional GridInformationService (GIS)
+ * entity that
* performs basic functionalities, such as storing a list of local resources,
* and asking other regional GIS entities for resources.
* <p>
@@ -29,48 +36,31 @@
* this class and to override {@link #processOtherEvent(Sim_event)}
* and/or {@link #registerOtherEntity()} method.
*
- * @author Agustin Caminero, Universidad de Castilla La Mancha (UCLM), Spain. Nov 2006.
- * Based on class RegionalGIS, Anthony Sulistio.
- * Things added or modified:
- * - failureNumResPattern_, failureResPattern_, failureTimePattern_,
- * failureLengthPattern_ all of these cwith ontinuous, discrete and variate versions
- * - gisID_
- * - setFailureGenerator(...)
- * - init(...)
- * - processOtherEvent(...): formerly it was empty
- * - registerOtherEntity(...): formerly it was empty
- * - failedResList_ -> removed
- * - processEndSimulation(...)
- * - getResourceCharacteristics(...)
- * - pollResource(...)
- * - pollReturn(...)
- * - processResourceFailed(...)
- * - write(...)
- * @invariant $none
- * @since GridSim 4.1
+ * @author Agustin Caminero
+ * @since GridSim Toolkit 4.1
+ * @see gridsim.index.RegionalGIS
*/
public class RegionalGISWithFailure extends AbstractGIS
{
-
// if there is a conflict, we can simply change this number
- private static final int GIS_WITH_FAILURE_BASE = 2000;
+ private static final int GIS_WITH_FAILURE_BASE = 2000; // TODO
-
- /** Denotes that an user has detected the failure of a resource. So, the user sends
+ /** Denotes that an user has detected the failure of a resource.
+ * So, the user sends
* this tag to the GIS to make it update its list of resources.
*/
- public static final int RESOURCE_FAILED = GIS_WITH_FAILURE_BASE + 1;
+ public static final int RESOURCE_FAILED = GIS_WITH_FAILURE_BASE + 1; // TODO:
/** This entity ID in <tt>Integer</tt> object. */
protected Integer myID_;
- public int gisID_;
// for a RegionalGISWithFailure named "RegionalGIS_2", the gisID_ will be 2
// This is also the number of the VO.
+ public int gisID_; // TODO: redundant ??
+ // denotes whether sim has just began or it has been running for some time
+ private boolean begining;
- private boolean begining;
- // denotes whether the sim has just began or it has been running for some time
private ArrayList resList_; // all resources within this region
private ArrayList arList_; // AR resources only within this region
private ArrayList globalResList_; // all resources outside this region
@@ -81,39 +71,45 @@
private int numRes_; // counting for num of GIS entities for res request
private int numAR_; // counting for num of GIS entities for res AR request
+ // defines how GIS should decide how many resource fails
+ private DiscreteGenerator failureNumResPatternDiscrete_;
- // TODO: the best way is to have a generic Object variable then cast it !!
+ // defines how GIS should decide when the resource will fail
+ private DiscreteGenerator failureTimePatternDiscrete_;
- private DiscreteGenerator failureNumResPatternDiscrete_;
- // defines how GIS should decide how many resource fails
- private DiscreteGenerator failureTimePatternDiscrete_;
- // defines how GIS should decide when the resource will fail
+ // defines how GIS should decide how long the resource will be out of order
private DiscreteGenerator failureLengthPatternDiscrete_;
- // defines how GIS should decide how long the resource will be out of order
+
+ // defines how GIS should decide how many resource fails
private ContinuousGenerator failureNumResPatternCont_;
- // defines how GIS should decide how many resource fails
+
+ // defines how GIS should decide when the resource will fail
private ContinuousGenerator failureTimePatternCont_;
- // defines how GIS should decide when the resource will fail
+
+ // defines how GIS should decide how long the resource will be out of order
private ContinuousGenerator failureLengthPatternCont_;
- // defines how GIS should decide how long the resource will be out of order
+
// New, as some distibutions coming with SimJava2 does not work
+ // defines how GIS should decide how many resource fails
private Variate failureNumResPatternVariate_;
- // defines how GIS should decide how many resource fails
+
+ // defines how GIS should decide when the resource will fail
private Variate failureTimePatternVariate_;
- // defines how GIS should decide when the resource will fail
+
+ // defines how GIS should decide how long the resource will be out of order
private Variate failureLengthPatternVariate_;
- // defines how GIS should decide how long the resource will be out of order
/**
* Creates a new regional GIS entity
* @param name this regional GIS name
* @param link a network link to this entity
- * @param failureLengthPattern defines how GIS should decide how long the resource will be out of order
- * @param failureNumResPattern defines how GIS should decide how many resource fails
- * @param failureTimePattern defines how GIS should decide when the resource will fail
+ * @param failureLengthPattern defines on how long
+ * each resource will be out of order
+ * @param failureNumResPattern defines on how many resource fails
+ * @param failureTimePattern defines on when each resource will fail
* @throws Exception This happens when creating this entity before
* initializing GridSim package or this entity name is
* <tt>null</tt> or empty
@@ -121,9 +117,11 @@
* @pre link != null
* @post $none
*/
- public RegionalGISWithFailure(String name, Link link, DiscreteGenerator failureNumResPattern,
- DiscreteGenerator failureTimePattern,
- DiscreteGenerator failureLengthPattern, int gisID) throws Exception
+ public RegionalGISWithFailure(String name, Link link,
+ DiscreteGenerator failureNumResPattern,
+ DiscreteGenerator failureTimePattern,
+ DiscreteGenerator failureLengthPattern, int gisID)
+ throws Exception
{
super(name, link);
gisID_ = gisID;
@@ -133,74 +131,74 @@
else
throw new Exception(super.get_name() +
" : Problem when setting the failure patterns for the " +
- super.get_name() + " entity");
-
+ super.get_name() + " entity");
}
/**
- * Creates a new regional GIS entity
- * @param name this regional GIS name
- * @param link a network link to this entity
- * @param failureLengthPattern defines how GIS should decide how long the resource will be out of order
- * @param failureNumResPattern defines how GIS should decide how many resource fails
- * @param failureTimePattern defines how GIS should decide when the resource will fail
- * @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
- */
- public RegionalGISWithFailure(String name, Link link, ContinuousGenerator failureNumResPattern,
- ContinuousGenerator failureTimePattern,
- ContinuousGenerator failureLengthPattern, int gisID) throws Exception
- {
- super(name, link);
- gisID_ = gisID;
+ * Creates a new regional GIS entity
+ * @param name this regional GIS name
+ * @param link a network link to this entity
+ * @param failureLengthPattern defines on how long
+ * each resource will be out of order
+ * @param failureNumResPattern defines on how many resource fails
+ * @param failureTimePattern defines on when each resource will fail
+ * @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
+ */
+ public RegionalGISWithFailure(String name, Link link,
+ ContinuousGenerator failureNumResPattern,
+ ContinuousGenerator failureTimePattern,
+ ContinuousGenerator failureLengthPattern, int gisID)
+ throws Exception
+ {
+ super(name, link);
+ gisID_ = gisID;
- if (setFailureGenerator(failureNumResPattern, failureTimePattern,
- failureLengthPattern))
- init();
- else
- throw new Exception(super.get_name() +
- " : Problem when setting the failure patterns for the " +
- super.get_name() + " entity");
+ if (setFailureGenerator(failureNumResPattern, failureTimePattern,
+ failureLengthPattern))
+ init();
+ else
+ throw new Exception(super.get_name() +
+ " : Problem when setting the failure patterns for the " +
+ super.get_name() + " entity");
+ }
- }
+ /**
+ * Creates a new regional GIS entity
+ * @param name this regional GIS name
+ * @param link a network link to this entity
+ * @param failureLengthPattern defines on how long
+ * each resource will be out of order
+ * @param failureNumResPattern defines on how many resource fails
+ * @param failureTimePattern defines on when each resource will fail
+ * @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
+ */
+ public RegionalGISWithFailure(String name, Link link,
+ Variate failureNumResPattern,
+ Variate failureTimePattern,
+ Variate failureLengthPattern, int gisID)
+ throws Exception
+ {
+ super(name, link);
+ gisID_ = gisID;
+ if (setFailureGenerator(failureNumResPattern, failureTimePattern,
+ failureLengthPattern))
+ init();
+ else
+ throw new Exception(super.get_name() +
+ " : Problem when setting the failure patterns for the " +
+ super.get_name() + " entity");
+ }
- /**
- * Creates a new regional GIS entity
- * @param name this regional GIS name
- * @param link a network link to this entity
- * @param failureLengthPattern defines how GIS should decide how long the resource will be out of order
- * @param failureNumResPattern defines how GIS should decide how many resource fails
- * @param failureTimePattern defines how GIS should decide when the resource will fail
- * @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
- */
- public RegionalGISWithFailure(String name, Link link,
- Variate failureNumResPattern,
- Variate failureTimePattern,
- Variate failureLengthPattern, int gisID) throws
- Exception
- {
- super(name, link);
- gisID_ = gisID;
- if (setFailureGenerator(failureNumResPattern, failureTimePattern,
- failureLengthPattern))
- init();
- else
- throw new Exception(super.get_name() +
- " : Problem when setting the failure patterns for the " +
- super.get_name() + " entity");
-
- }
-
-
/**
* Initialises all attributes
* @pre $none
@@ -248,13 +246,16 @@
result = true;
write("Registering", id.intValue(), GridSim.clock());
- if (list.size() == 1) // REMOVE !!!
- System.out.println(super.get_name() + ": The list has one resource again. Clock:" + GridSim.clock());
+ if (list.size() == 1) { // REMOVE !!!
+ System.out.println(super.get_name() +
+ ...
[truncated message content] |