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]);
            }
        }

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

        // hold for few period - 1000 seconds since the Gridlets length are
        // quite huge for a small bandwidth
        super.gridSimHold(1000);

        // receives the gridlet back
        for (i = 0; i < list_.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_);
    }