public void body() {

        // if it is a local RC, then use its resource entity ID
        int id = -1;
        if (localRC_) {
            id = resourceID_;
        }
        // otherwise, use my entity ID
        else {
            id = super.get_id();
        }

        // register to central/main GIS if no regional GIS exists
        if (gisID_ == -1) {
            gisID_ = GridSim.getGridInfoServiceEntityId();
        }
        // need to wait for few seconds before registering to a regional GIS.
        // This is because to allow all routers to fill in their routing tables
        else
        {
            String name = GridSim.getEntityName(gisID_);
            super.sim_pause(GridSim.PAUSE);
            System.out.println(super.get_name() + ".body(): wait for " +
                GridSim.PAUSE + " seconds before registering to " + name);
        }

        // register to a GIS entity first
        int register = DataGridTags.REGISTER_REPLICA_CTLG;
        super.send(super.output, GridSimTags.SCHEDULE_NOW, register,
                   new IO_data(new Integer(id), DataGridTags.PKT_SIZE, gisID_));

        // Below method is for a child class to override
        registerOtherEntity();

        // Process events until END_OF_SIMULATION is received from the
        // GridSimShutdown Entity
        Sim_event ev = new Sim_event();
        while (Sim_system.running()) {
            super.sim_get_next(ev);

            // if the simulation finishes then exit the loop
            if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) {
                processEndSimulation();
                break;
            }

            // process the received event
            processEvent(ev);
        }

        // remove I/O entities created during construction of this entity
        super.terminateIOEntities();
    }