private void collectGridlet()
    {
        System.out.println(super.get_name() + ": Collecting Gridlets ...");
        list_ = new ArrayList(gridletID_ + 1);

        Object data = null;
        Gridlet gl = null;

        int counter = 1;    // starts at 1, since gridletID_ starts at 1 too
        Sim_event ev = new Sim_event();
        while ( Sim_system.running() )
        {
            super.sim_get_next(ev);     // get the next available event
            data = ev.get_data();       // get the event's data

            // handle ping request
            if (ev.get_tag() == GridSimTags.INFOPKT_SUBMIT)
            {
                processPingRequest(ev);
                continue;
            }

            // get the Gridlet data
            if (data != null && data instanceof Gridlet)
            {
                gl = (Gridlet) data;
                list_.add(gl);
                counter++;
            }

            // if all the Gridlets have been collected
            if (counter == gridletID_) {
                break;
            }
        }
    }