protected GISReply requestToGIS() {
    int SIZE = 500;
    double evsend_time = 0;
    GISRequest request = new GISRequest(this.get_id(), this.get_id());
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.GIS_REQUEST,
        new IO_data(request, SIZE, super.getEntityId("GISService")));
    evsend_time = GridSim.clock();
    String msg =
        String.format("%1$f %2$d %3$s --> GAP GIS_REQUEST", evsend_time, reqrepID, this.get_name());
    this.write(msg);

    Sim_event ev = new Sim_event();
    Predicate predicate = new Predicate(Tags.GIS_REPLY);
    super.sim_get_next(predicate, ev); // only look for this type of ack
    GISReply reply = GISReply.get_data(ev);
    Assert.assertEquals(requestID, reply.getRequestID());
    Assert.assertEquals(Tags.GIS_REQUEST, reply.getRequestTAG());
    Assert.assertEquals(Tags.GIS_REPLY, ev.get_tag());
    double evrecv_time = GridSim.clock();
    msg =
        String.format(
            "%1$f %2$d %3$s <-- GAP GIS_REPLY\n",
            evrecv_time, reqrepID, this.get_name(), reply.getGIS());
    this.write(msg);
    return reply;
  }
  public AgentReply hasGridletsAgent(AgentRequest request, boolean trace) {
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    double evsend_time = 0;
    int agentType = request.getDst_entityType();
    int SIZE = 500;
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.HASGRIDLETS_REQUEST,
        new IO_data(request, SIZE, request.getDst_agentID()));
    evsend_time = GridSim.clock();
    String msg =
        String.format(
            "%1$f %2$d %3$s --> AM_%4$s::HASGRIDLETS_REQUEST %6$s (%7$s AID %9$d) %5$s AM_%8$s",
            evsend_time,
            reqrepID,
            this.get_name(),
            super.getEntityName(request.getDst_resID()),
            EntityTypes.toString(request.getDst_entityType()),
            Tags.toString(Tags.HASGRIDLETS_REQUEST),
            super.getEntityName(request.getDst_agentID()),
            super.getEntityName(request.getDst_moveToresID()),
            request.getDst_AID());
    if (trace) {
      this.write(msg);
    }

    Sim_type_p ptag = new Sim_type_p(Tags.HASGRIDLETS_REPLY);
    Sim_event ev = new Sim_event();
    super.sim_get_next(ptag, ev); // only look for this type of ack
    AgentReply agentReply = AgentReply.get_data(ev);
    if (agentReply == null) {
      Assert.fail();
    }
    Assert.assertEquals(requestID, agentReply.getRequestID());
    Assert.assertEquals(Tags.HASGRIDLETS_REQUEST, agentReply.getRequestTAG());
    Assert.assertEquals(ev.get_tag(), Tags.HASGRIDLETS_REPLY);

    double evrecv_time = GridSim.clock();
    msg =
        String.format(
            "%1$f %2$d %3$s <-- AM_%4$s::%7$s %8$s (%6$s AID %10$d) %5$s AM_%9$s",
            evrecv_time,
            reqrepID,
            this.get_name(),
            super.getEntityName(agentReply.getRequest().getDst_resID()),
            EntityTypes.toString(agentType),
            super.getEntityName(request.getDst_agentID()),
            agentReply.isOk(),
            Tags.toString(Tags.HASGRIDLETS_REPLY),
            super.getEntityName(request.getDst_moveToresID()),
            request.getDst_AID());
    if (trace) {
      this.write(msg);
    }
    return agentReply;
  }
  public GridletReply askGridletStatusToAgent(int dst_agentID, int dst_resID, Gridlet gridlet) {
    GridletRequest request =
        new GridletRequest(this.get_id(), this.get_id(), dst_agentID, dst_resID, gridlet);
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.GRIDLET_STATUS_REQ,
        new IO_data(request, gridlet.getGridletFileSize(), request.getDst_agentID()));

    Sim_type_p ptag = new Sim_type_p(Tags.GRIDLET_STATUS_REP);
    Sim_event ev = new Sim_event();
    super.sim_get_next(ptag, ev); // only look for this type of ack
    GridletReply gridletReply = GridletReply.get_data(ev);

    Assert.assertEquals(requestID, gridletReply.getRequestID());
    Assert.assertEquals(Tags.GRIDLET_STATUS_REQ, gridletReply.getRequestTAG());
    Assert.assertEquals(Tags.GRIDLET_STATUS_REP, ev.get_tag());
    double evrecv_time = GridSim.clock();
    String msg =
        String.format(
            "%1$f %2$d %3$s <-- GOT GRIDLET_STATUS_REP for Gridlet %4$d of Gridlet %5$d with status %6$d",
            evrecv_time,
            reqrepID,
            this.get_name(),
            gridletReply.getReceivedGridlet().getGridletID(),
            gridletReply.getRequest().getGridlet().getGridletID(),
            gridletReply.getRequest().getGridlet().getGridletStatus());
    this.write(msg);
    return gridletReply;
  }
  public AgentReply testTestService() {
    double evsend_time = 0;
    int SIZE = 500;
    AgentRequest request = null;
    request =
        new AgentRequest(
            this.get_id(),
            this.get_id(),
            null,
            this.getVirtualOrganization().getPlatform().getGridElement().get_id(),
            Sim_system.get_entity_id("TestService"),
            EntityTypes.AGENT_ZOMBIE,
            SIZE,
            this.getVirtualOrganization().getPlatform().getGridElement().get_id(),
            EntityTypes.NOBODY);
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.TEST_SERVICE_REQ,
        new IO_data(request, SIZE, Sim_system.get_entity_id("TestService")));
    evsend_time = GridSim.clock();

    String msg =
        String.format(
            "%1$f %2$d %3$s --> %4$s", evsend_time, reqrepID, this.get_name(), "TestService");
    this.write(msg);

    Sim_type_p ptag = new Sim_type_p(Tags.TEST_SERVICE_REP);
    Sim_event ev = new Sim_event();
    super.sim_get_next(ptag, ev); // only look for this type of ack
    AgentReply reply = AgentReply.get_data(ev);

    Assert.assertEquals(requestID, reply.getRequestID());
    Assert.assertEquals(Tags.TEST_SERVICE_REQ, reply.getRequestTAG());
    Assert.assertEquals(Tags.TEST_SERVICE_REP, ev.get_tag());

    double evrecv_time = GridSim.clock();

    msg =
        String.format(
            "%1$f %2$d %3$s <-- %4$s", evrecv_time, reqrepID, this.get_name(), "TestService");
    this.write(msg);

    return reply;
  }
  protected ServicesListReply requestServicesList() {
    int SIZE = 500;
    double evsend_time = 0;
    ServicesListRequest request = new ServicesListRequest(this.get_id(), this.get_id());
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.AP_SERVICES_LIST_REQ,
        new IO_data(request, SIZE, this.getVirtualOrganization().getPlatform().get_id()));
    evsend_time = GridSim.clock();
    String msg =
        String.format(
            "%1$f %2$d %3$s --> %4$s SERVICES_LIST_REQUEST",
            evsend_time,
            reqrepID,
            this.get_name(),
            this.getVirtualOrganization().getPlatform().get_name());
    this.write(msg);

    Sim_event ev = new Sim_event();
    Predicate predicate = new Predicate(Tags.AP_SERVICES_LIST_REP);
    super.sim_get_next(predicate, ev); // only look for this type of ack
    ServicesListReply reply = ServicesListReply.get_data(ev);
    Assert.assertEquals(requestID, reply.getRequestID());
    Assert.assertEquals(Tags.AP_SERVICES_LIST_REQ, reply.getRequestTAG());
    Assert.assertEquals(Tags.AP_SERVICES_LIST_REP, ev.get_tag());
    double evrecv_time = GridSim.clock();
    msg =
        String.format(
            "%1$f %2$d %3$s <-- %4$s SERVICES_LIST_REPLY %5$s",
            evrecv_time,
            reqrepID,
            this.get_name(),
            this.getVirtualOrganization().getPlatform().get_name(),
            reply.getServicesList());
    this.write(msg);
    return reply;
  }
  protected PingReply requestPing(int src_id, int dst_id) {
    int SIZE = 500;
    double evsend_time = 0;
    PingRequest request = new PingRequest(this.get_id(), this.get_id(), src_id, dst_id);
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output, GridSimTags.SCHEDULE_NOW, Tags.PING_REQ, new IO_data(request, SIZE, src_id));
    evsend_time = GridSim.clock();
    String msg =
        String.format(
            "%1$f %2$d %3$s --> AM_%4$s PING_REQUEST AM_%5$s",
            evsend_time,
            reqrepID,
            this.get_name(),
            super.getEntityName(src_id),
            super.getEntityName(dst_id));
    this.write(msg);

    Sim_event ev = new Sim_event();
    Predicate predicate = new Predicate(Tags.PING_REP);
    super.sim_get_next(predicate, ev); // only look for this type of ack
    PingReply reply = PingReply.get_data(ev);
    Assert.assertEquals(requestID, reply.getRequestID());
    Assert.assertEquals(Tags.PING_REQ, reply.getRequestTAG());
    Assert.assertEquals(Tags.PING_REP, ev.get_tag());
    double evrecv_time = GridSim.clock();
    msg =
        String.format(
            "%1$f %2$d %3$s <-- AM_%4$s PING_REQUEST AM_%5$s",
            evrecv_time,
            reqrepID,
            this.get_name(),
            super.getEntityName(src_id),
            super.getEntityName(dst_id));
    this.write(msg);
    return reply;
  }
Exemple #7
0
  /**
   * Finalises all relevant information before <tt>exiting</tt> the GridResource entity. This method
   * sets the final data of:
   *
   * <ul>
   *   <li>wall clock time, i.e. the time of this Gridlet resides in a GridResource (from arrival
   *       time until departure time).
   *   <li>actual CPU time, i.e. the total execution time of this Gridlet in a GridResource.
   *   <li>Gridlet's finished so far
   * </ul>
   *
   * @pre $none
   * @post $none
   */
  public void finalizeGridlet() {
    // Sets the wall clock time and actual CPU time
    double wallClockTime = GridSim.clock() - arrivalTime;
    gridlet.setExecParam(wallClockTime, totalCompletionTime);

    double finished = 0;
    if (gridlet.getGridletLength() < finishedSoFar) {
      finished = gridlet.getGridletLength();
    } else {
      finished = finishedSoFar;
    }

    gridlet.setGridletFinishedSoFar(finished);
  }
Exemple #8
0
  /**
   * Sets the Gridlet status.
   *
   * @param status the Gridlet status
   * @return <code>true</code> if the new status has been set, <code>false</code> otherwise
   * @pre status >= 0
   * @post $none
   */
  public boolean setStatus(int status) {
    // gets Gridlet's previous status
    int prevStatus = gridlet.getGridletStatus();

    // if the status of a Gridlet is the same as last time, then ignore
    if (prevStatus == status) {
      return false;
    }

    boolean success = true;
    try {
      double clock = GridSim.clock(); // gets the current clock

      // sets Gridlet's current status
      try {
        gridlet.setGridletStatus(status);
      } catch (Exception e) {
        // It should not happen
      }

      // if a previous Gridlet status is INEXEC
      if (prevStatus == Gridlet.INEXEC) {
        // and current status is either CANCELED, PAUSED or SUCCESS
        if (status == Gridlet.CANCELED || status == Gridlet.PAUSED || status == Gridlet.SUCCESS) {
          // then update the Gridlet completion time
          totalCompletionTime += (clock - startExecTime);
          return true;
        }
      }

      if (prevStatus == Gridlet.RESUMED && status == Gridlet.SUCCESS) {
        // then update the Gridlet completion time
        totalCompletionTime += (clock - startExecTime);
        return true;
      }

      // if a Gridlet is now in execution
      if (status == Gridlet.INEXEC || (prevStatus == Gridlet.PAUSED && status == Gridlet.RESUMED)) {
        startExecTime = clock;
        gridlet.setExecStartTime(startExecTime);
      }
    } catch (IllegalArgumentException e) {
      success = false;
    }

    return success;
  }
  public GridletReply submitGridletToAgent(int dst_agentID, int dst_resID, Gridlet gridlet) {
    GridletRequest request =
        new GridletRequest(this.get_id(), this.get_id(), dst_agentID, dst_resID, gridlet);
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    super.send(
        super.output,
        GridSimTags.SCHEDULE_NOW,
        Tags.GRIDLET_SUBMIT_REQ,
        new IO_data(request, gridlet.getGridletFileSize(), request.getDst_agentID()));

    Sim_type_p ptag = new Sim_type_p(Tags.GRIDLET_SUBMIT_REP);
    Sim_event ev = new Sim_event();
    super.sim_get_next(ptag, ev); // only look for this type of ack
    GridletReply reply = GridletReply.get_data(ev);

    Assert.assertEquals(requestID, reply.getRequestID());
    Assert.assertEquals(Tags.GRIDLET_SUBMIT_REQ, reply.getRequestTAG());
    Assert.assertEquals(Tags.GRIDLET_SUBMIT_REP, ev.get_tag());
    double evrecv_time = GridSim.clock();
    if (reply.isOk()) {
      String msg =
          String.format(
              "%1$f %2$d %3$s <-- GOT GRIDLET_REPLY for Gridlet %4$d of Gridlet %5$d with result TRUE on AM_%6$s",
              evrecv_time,
              reqrepID,
              this.get_name(),
              reply.getReceivedGridlet().getGridletID(),
              reply.getRequest().getGridlet().getGridletID(),
              super.getEntityName(reply.getRequest().getDst_resID()));
      this.write(msg);
    } else {
      String msg =
          String.format(
              "%1$f %2$d %3$s <-- GOT GRIDLET_REPLY for Gridlet %4$d of Gridlet %5$d with result FALSE on AM_%6$s",
              evrecv_time,
              reqrepID,
              this.get_name(),
              reply.getReceivedGridlet().getGridletID(),
              reply.getRequest().getGridlet().getGridletID(),
              super.getEntityName(reply.getRequest().getDst_resID()));
      this.write(msg);
    }
    return reply;
  }
Exemple #10
0
  /*
   * Initialises all local attributes
   * @pre $none
   * @post $none
   */
  private void init() {

    this.arrivalTime = GridSim.clock();
    this.gridlet.setSubmissionTime(arrivalTime);

    // default values
    this.actualFinishTime = NOT_FOUND; // Cannot finish in this hourly slot.
    this.expectedFinishTime = NOT_FOUND;
    this.startTime = NOT_FOUND;
    this.totalCompletionTime = 0L;
    this.startExecTime = 0L;
    this.partition = NOT_FOUND;
    this.priority = NOT_FOUND;

    // In case a Gridlet has been executed partially by some other grid
    // resources.
    this.finishedSoFar = gridlet.getGridletFinishedSoFar();
  }
Exemple #11
0
  /**
   * Simple Local Search optimization. Avg. start time, avg. wait time and avg. slowdown are used as
   * decision maker. Jobs are moved to gaps.
   */
  @Override
  public void execute(int rounds, int time_limit) {
    // System.out.println(GridSim.clock() + ": executing Gap Search...");
    rounds = rounds * ExperimentSetup.multiplicator;
    time_limit = time_limit * ExperimentSetup.multiplicator;
    double current_time = GridSim.clock();

    Date dd = new Date();
    long start = dd.getTime();

    // empty schedule cannot be optimized
    if (Scheduler.getScheduleSize() > 1) {
      for (int i = 0; i < rounds; i++) {
        double previous_resp = CommonObjectives.predictAvgResponseTime(current_time);
        double previous_fair = CommonObjectives.predictFairness(current_time);
        double previous_wait = CommonObjectives.predictAvgWaitTime(current_time);
        double previous_sd = CommonObjectives.predictAvgSlowdown(current_time);

        int index_prev = findRandonResource();
        ResourceInfo prev_res = (ResourceInfo) Scheduler.resourceInfoList.get(index_prev);
        int gridlet_index = findRandomGridletInfo(index_prev);

        // this schedule has no gridlets
        if (gridlet_index == -1) {
          continue;
        }
        // remove the gridlet and update the resource internal information
        GridletInfo gi = (GridletInfo) prev_res.removeGInfoIndex(gridlet_index);
        prev_res.update(current_time);
        boolean succ = false;

        // we will test schedules in random order
        int permutation[] = Scheduler.permute(Scheduler.resourceInfoList.size());
        for (int j = 0; j < permutation.length; j++) {

          ResourceInfo ri = (ResourceInfo) Scheduler.resourceInfoList.get(permutation[j]);
          if (!Scheduler.isSuitable(ri, gi)) {
            continue;
          }
          // find new placement for a job
          boolean found = ri.findHoleForGridlet(gi);
          if (found) {
            double new_decision = 0.0;
            // double current_usage = predictMachineUsage(current_time);
            // double current_start = predictAvgStartTime(current_time);
            // double us = Math.max(0.0000000000001, previous_usage);
            // double diff_u = (current_usage - previous_usage) / us;

            double current_fair = CommonObjectives.predictFairness(current_time);
            double fair = Math.max(0.0000000000001, previous_fair);
            double diff_fair = (previous_fair - current_fair) / fair;

            double current_resp = CommonObjectives.predictAvgResponseTime(current_time);
            double rt = Math.max(0.0000000000001, previous_resp);
            double diff_rt = (previous_resp - current_resp) / rt;

            double current_wait = CommonObjectives.predictAvgWaitTime(current_time);
            double wt = Math.max(0.0000000000001, previous_wait);
            double diff_wt = (previous_wait - current_wait) / wt;

            double current_sd = CommonObjectives.predictAvgSlowdown(current_time);
            double sd = Math.max(1.0, previous_sd);
            double diff_sd = (previous_sd - current_sd) / sd;

            new_decision =
                (diff_fair * ExperimentSetup.fair_weight)
                    + (diff_rt * 1.0)
                    + (diff_wt * 1.0)
                    + (diff_sd * 1.0);

            if (new_decision <= 0.0) {
              /*if (new_decision == 0.0) {
              succ_eq++;
              } else {
              succ_less++;
              }*/
              ri.removeGInfo(gi);
              continue;
            } else {

              succ = true;
              break;
            }
          }
        }
        // no better placement was found - return the gridlet to the previous position
        // and make another round of LocalSearch
        if (!succ) {
          prev_res.addGInfo(gridlet_index, gi);
        }

        Date d_end = new Date();
        long is_end = d_end.getTime();
        if ((is_end - start) >= time_limit) {
          Scheduler.updateResourceInfos(current_time);
          return;
        }
      }
    }
    Scheduler.updateResourceInfos(current_time);
  }
  AgentReply requestToAgent(AgentRequest request, int tag) {
    int requestID = request.getRequestID();
    int reqrepID = request.getReqrepID();
    double evsend_time = 0;
    int agentType = request.getDst_entityType();
    int SIZE;
    if (tag == Tags.AGENT_RUN_REQ) {
      SIZE = request.getDst_agentSize();
    } else {
      SIZE = 500;
    }
    if ((tag == Tags.AGENT_RUN_REQ)
        || (tag == Tags.AGENT_KILL_REQ)
        || (tag == Tags.AGENT_KILLAWAIT_REQ)
        || (tag == Tags.AGENT_PAUSE_REQ)
        || (tag == Tags.AGENT_RESUME_REQ)) {
      super.send(
          super.output,
          GridSimTags.SCHEDULE_NOW,
          tag,
          new IO_data(request, SIZE, request.getDst_resID()));
    } else {
      super.send(
          super.output,
          GridSimTags.SCHEDULE_NOW,
          tag,
          new IO_data(request, SIZE, request.getDst_agentID()));
    }
    evsend_time = GridSim.clock();
    String msg =
        String.format(
            "%1$f %2$d %3$s --> AM_%4$s::REQUEST %6$s (%7$s AID %9$d) %5$s AM_%8$s",
            evsend_time,
            reqrepID,
            this.get_name(),
            super.getEntityName(request.getDst_resID()),
            EntityTypes.toString(request.getDst_entityType()),
            Tags.toString(tag),
            super.getEntityName(request.getDst_agentID()),
            super.getEntityName(request.getDst_moveToresID()),
            request.getDst_AID());
    this.write(msg);

    Sim_type_p ptag = new Sim_type_p(tag + 1);
    Sim_event ev = new Sim_event();
    super.sim_get_next(ptag, ev); // only look for this type of ack
    AgentReply agentReply = AgentReply.get_data(ev);

    if (agentReply != null) {
      Assert.assertEquals(requestID, agentReply.getRequestID());
      Assert.assertEquals(tag, agentReply.getRequestTAG());
      Assert.assertEquals(ev.get_tag(), tag + 1);

      double evrecv_time = GridSim.clock();
      msg =
          String.format(
              "%1$f %2$d %3$s <-- AM_%4$s::%7$s %8$s (%6$s AID %10$d) %5$s AM_%9$s",
              evrecv_time,
              reqrepID,
              this.get_name(),
              super.getEntityName(agentReply.getRequest().getDst_resID()),
              EntityTypes.toString(agentType),
              super.getEntityName(request.getDst_agentID()),
              agentReply.isOk(),
              Tags.toString(tag),
              super.getEntityName(request.getDst_moveToresID()),
              request.getDst_AID());
      this.write(msg);
    }
    return agentReply;
  }
 /**
  * This method returns the current time.
  *
  * @return the current time.
  * @see Profile#currentTime()
  */
 protected double currentTime() {
   return GridSim.clock();
 }
Exemple #14
0
  /** The core method that handles communications among GridSim entities. */
  public void body() {
    // wait for a little while for about 3 seconds.
    // This to give a time for GridResource entities to register their
    // services to GIS (GridInformationService) entity.
    super.gridSimHold(3.0);
    LinkedList resList = super.getGridResourceList();

    // initialises all the containers
    int totalResource = resList.size();
    int resourceID[] = new int[totalResource];
    String resourceName[] = new String[totalResource];

    // a loop to get all the resources available
    int i = 0;
    for (i = 0; i < totalResource; i++) {
      // Resource list contains list of resource IDs
      resourceID[i] = ((Integer) resList.get(i)).intValue();

      // get their names as well
      resourceName[i] = GridSim.getEntityName(resourceID[i]);
    }

    ////////////////////////////////////////////////
    // SUBMIT Gridlets

    // determines which GridResource to send to
    int index = myId_ % totalResource;
    if (index >= totalResource) {
      index = 0;
    }

    // sends all the Gridlets
    Gridlet gl = null;
    boolean success;
    for (i = 0; i < list_.size(); i++) {
      gl = (Gridlet) list_.get(i);

      // For even number of Gridlets, send with an acknowledgement
      if (i % 2 == 0) {
        success = super.gridletSubmit(gl, resourceID[index], 0.0, true);
        System.out.println(
            name_
                + ": Sending Gridlet #"
                + gl.getGridletID()
                + " with status = "
                + success
                + " to "
                + resourceName[index]);
      }

      // For odd number of Gridlets, send without an acknowledgement
      else {
        success = super.gridletSubmit(gl, resourceID[index], 0.0, false);
        System.out.println(
            name_
                + ": Sending Gridlet #"
                + gl.getGridletID()
                + " with NO ACK so status = "
                + success
                + " to "
                + resourceName[index]);
      }
    }

    //////////////////////////////////////////
    // CANCELING Gridlets

    // hold for few period -- 100 seconds
    super.gridSimHold(15);
    System.out.println("<<<<<<<<< pause for 15 >>>>>>>>>>>");

    // a loop that cancels an even number of Gridlet
    for (i = 0; i < list_.size(); i++) {
      if (i % 2 == 0) {
        gl = super.gridletCancel(i, myId_, resourceID[index], 0.0);
        System.out.print(name_ + ": Canceling Gridlet #" + i + " at time = " + GridSim.clock());

        if (gl == null) {
          System.out.println(" result = NULL");
        } else // if Cancel is successful, then add it into the list
        {
          System.out.println(" result = NOT null");
          receiveList_.add(gl);
        }
      }
    }

    ////////////////////////////////////////////////////////
    // RECEIVES Gridlets back

    // hold for few period - 1000 seconds since the Gridlets length are
    // quite huge for a small bandwidth
    super.gridSimHold(1000);
    System.out.println("<<<<<<<<< pause for 1000 >>>>>>>>>>>");

    // receives the gridlet back
    int size = list_.size() - receiveList_.size();
    for (i = 0; i < size; i++) {
      gl = (Gridlet) super.receiveEventObject(); // gets the Gridlet
      receiveList_.add(gl); // add into the received list

      System.out.println(
          name_ + ": Receiving Gridlet #" + gl.getGridletID() + " at time = " + GridSim.clock());
    }

    System.out.println(this.name_ + ":%%%% Exiting body() at time " + GridSim.clock());

    // shut down I/O ports
    shutdownUserEntity();
    terminateIOEntities();

    // Prints the simulation output
    printGridletList(receiveList_, name_);
  }