|
From: <mar...@us...> - 2008-02-05 02:43:50
|
Revision: 87
http://gridsim.svn.sourceforge.net/gridsim/?rev=87&view=rev
Author: marcos_dias
Date: 2008-02-04 18:43:51 -0800 (Mon, 04 Feb 2008)
Log Message:
-----------
Small changes in the provision of reservation options. Now the options are part of the reservation object.
Modified Paths:
--------------
branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java
branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java
branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2008-02-05 00:28:29 UTC (rev 86)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARMessage.java 2008-02-05 02:43:51 UTC (rev 87)
@@ -29,12 +29,6 @@
private int errorCode_; // an error code associated with the operation required
private Reservation reservation_; // the negotiation this message is about
- // If a Grid resource cannot make a reservation, it may provide options
- // by informing the reservation requester when resource will be available to
- // fulfil the reservation. This attribute contains the list of PEs
- // available at a set of simulation times
- private AvailabilityInfo resOptions_;
-
// the price associate with this message
private double price_;
@@ -76,6 +70,10 @@
/** Indicates that the operation requested could not be fulfilled */
public static final int EC_OPERATION_FAILURE = 1;
+ /** Indicates that the operation requested could not be fulfilled,
+ * but advance reservation options are provided */
+ public static final int EC_OPERATION_FAILURE_BUT_OPTIONS = 2;
+
private static int lastUniqueID;
static{
@@ -114,7 +112,6 @@
msgType_ = TYPE_UNKNOWN;
errorCode_ = EC_NO_ERROR;
reservation_ = null;
- resOptions_ = null;
}
/**
@@ -163,7 +160,6 @@
msgId_ = ARMessage.createUniqueID();
reservation_ = reservation;
errorCode_ = EC_NO_ERROR;
- resOptions_ = null;
}
/**
@@ -384,22 +380,6 @@
}
/**
- * Gets the reservation options given by the Grid resource
- * @return the reservation options
- */
- public AvailabilityInfo getReservationOptions() {
- return resOptions_;
- }
-
- /**
- * Sets the reservation options given by the Grid resource
- * @param resOptions the reservation options object
- */
- public void setReservationOptions(AvailabilityInfo resOptions) {
- resOptions_ = resOptions;
- }
-
- /**
* Returns the size in bytes for this message.
* <tt>NOTE:</tt> This is used to get network statistics
* @return the size in bytes of this message
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-05 00:28:29 UTC (rev 86)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ARParallelSpaceShared.java 2008-02-05 02:43:51 UTC (rev 87)
@@ -649,7 +649,7 @@
AvailabilityInfo availability = getAvailabilityInfo(startTime, duration);
// sets the options as the availability over the requested period
- response.setReservationOptions(availability);
+ response.getReservation().setReservationOptions(availability);
// Sends the response back to the user
super.sendARMessage(response);
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2008-02-05 00:28:29 UTC (rev 86)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/Reservation.java 2008-02-05 02:43:51 UTC (rev 87)
@@ -35,6 +35,12 @@
private int reservID_; // reservation ID
private double submissionTime_; // the time of submission of this advance reservation
+ // If a Grid resource cannot make a reservation, it may provide options
+ // by informing the reservation requester when resource will be available to
+ // fulfil the reservation. This attribute contains the list of PEs
+ // available at a set of simulation times
+ private AvailabilityInfo resOptions_;
+
private static final int NOT_FOUND = -1; // constant
private static int lastReservationId_ = 0;
@@ -301,7 +307,23 @@
public int getID() {
return reservID_;
}
+
+ /**
+ * Gets the reservation options given by the Grid resource
+ * @return the reservation options
+ */
+ public AvailabilityInfo getReservationOptions() {
+ return resOptions_;
+ }
+ /**
+ * Sets the reservation options given by the Grid resource
+ * @param resOptions the reservation options object
+ */
+ public void setReservationOptions(AvailabilityInfo resOptions) {
+ resOptions_ = resOptions;
+ }
+
/**
* Returns a clone of this object
* @return a cloned reservation object
Modified: branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java
===================================================================
--- branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2008-02-05 00:28:29 UTC (rev 86)
+++ branches/gridsim4.0-branch3/source/gridsim/turbo/ReservationRequester.java 2008-02-05 02:43:51 UTC (rev 87)
@@ -144,6 +144,9 @@
if(error == ARMessage.EC_NO_ERROR) {
reservations_.put(reservation.getID(), reservation);
}
+ else if(error == ARMessage.EC_OPERATION_FAILURE_BUT_OPTIONS) {
+ reservation = reply.getReservation();
+ }
else {
System.out.println(super.get_name() + ": Reservation # " +
reservation.getID() + " has not been accepted by "+
@@ -356,7 +359,7 @@
// Otherwise, print the error message
int error = reply.getErrorCode();
if(error == ARMessage.EC_NO_ERROR) {
- resOptions = reply.getReservationOptions();
+ resOptions = reply.getReservation().getReservationOptions();
}
else {
System.out.println(super.get_name() + ": Resource # " + resID +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|