public void body()
    {
        int resourceID[] = new int[this.totalResource_];
        String resourceName[] = new String[this.totalResource_];

        LinkedList resList;
        ResourceCharacteristics resChar;

        // waiting to get list of resources. Since GridSim package uses
        // multi-threaded environment, your request might arrive earlier
        // before one or more grid resource entities manage to register
        // themselves to GridInformationService (GIS) entity.
        // Therefore, it's better to wait in the first place
        while (true)
        {
            // need to pause for a while to wait GridResources finish
            // registering to GIS
            super.gridSimHold(1.0);    // hold by 1 second

            resList = getGridResourceList();
            if (resList.size() == this.totalResource_)
                break;
            else
            {
                System.out.println(this.name_ +
                        ":Waiting to get list of resources ...");
            }
        }

        int SIZE = 12;   // size of Integer object is roughly 12 bytes
        int i = 0;
        
        // a loop to get all the resources available.
        // Once the resources are known, then send HELLO and TEST tag to each
        // of them.
        for (i = 0; i < this.totalResource_; i++)
        {
            // Resource list contains list of resource IDs not grid resource
            // objects.
            resourceID[i] = ( (Integer) resList.get(i) ).intValue();

            // Requests to resource entity to send its characteristics
            // NOTE: sending directly without using I/O port
            super.send(resourceID[i], GridSimTags.SCHEDULE_NOW,
                       GridSimTags.RESOURCE_CHARACTERISTICS, this.ID_);

            // waiting to get a resource characteristics
            resChar = (ResourceCharacteristics) receiveEventObject();
            resourceName[i] = resChar.getResourceName();

            // print that this entity receives a particular resource 
            // characteristics
            System.out.println(this.name_ +
                    ":Received ResourceCharacteristics from " +
                    resourceName[i] + ", with id = " + resourceID[i]);

            // send TEST tag to a resource using I/O port.
            // It will consider transfer time over a network.
            System.out.println(this.name_ + ": Sending TEST tag to " +
                    resourceName[i] + " at time " + GridSim.clock());
            super.send( super.output, GridSimTags.SCHEDULE_NOW, TEST,
                    new IO_data(this.ID_, SIZE, resourceID[i]) );
                    
            // send HELLO tag to a resource using I/O port
            System.out.println(this.name_ + ": Sending HELLO tag to " +
                    resourceName[i] + " at time " + GridSim.clock());
            super.send( super.output, GridSimTags.SCHEDULE_NOW, HELLO,
                    new IO_data(this.ID_, SIZE, resourceID[i]) );
        }

        // need to wait for 10 seconds to allow a resource to process
        // receiving events.
        super.sim_pause(10);
        
        // shut down all the entities, including GridStatistics entity since
        // we used it to record certain events.
        shutdownGridStatisticsEntity();
        shutdownUserEntity();
        terminateIOEntities();
        System.out.println(this.name_ + ":%%%% Exiting body()");
    }