public void processGridletReturn(Sim_event ev)
    {
        Object obj = (Object) ev.get_data();
        Gridlet gl = null;

        int glID;

        if (obj instanceof Gridlet)
        {
            gl = (Gridlet) obj;

            glID = gl.getGridletID();
            System.out.println("<<< " + super.get_name() +
                ": Receiving Gridlet #" + glID + " with status " +
                gl.getGridletStatusString() + " at time = " + GridSim.clock() +
                " from " + GridSim.getEntityName(gl.getResourceID()) );

            // Write into a file
            write(super.get_name(), "Receiving", glID,
                  GridSim.getEntityName(gl.getResourceID()),
                  gl.getGridletStatusString(), GridSim.clock());

            receivedGridletCounter++;

            // find out the total execution time, from the submission time
            gridletLatencyTime[glID] = GridSim.clock() -
                        gridletSubmissionTime[glID];

            // get the latest status of a gridlet
            gridletStatus[glID] = gl.getGridletStatusString();

            // remove the gridlet
            removeGridletFromGridletSubmittedList(glID);
            gl = null;

            // We have received all the gridlets. So, finish the simulation.
            if ((receivedGridletCounter == NUM_GRIDLETS) ||
               (receivedGridletCounter + droppedGridletsCounter == NUM_GRIDLETS))
            {
                super.finishSimulation();
                //System.out.println("**** " + super.get_name() + ": FINISHED!!");
            }


            System.out.println("<<< " + super.get_name() +
                    ": Finished processing the return of Gridlet # " +
                    glID + "\nReceived: " + receivedGridletCounter +
                    ". Dropped: " + droppedGridletsCounter + 
                    ". NUM_GRIDLETS: " + NUM_GRIDLETS);


        } // if (obj instanceof Gridlet)
    }