private void gridletFinish(ResGridlet rgl, int status)
    {
        // Set PE on which Gridlet finished to FREE
        super.resource_.setStatusPE(PE.FREE, rgl.getMachineID(), rgl.getPEID());

        // the order is important! Set the status first then finalize
        // due to timing issues in ResGridlet class
        rgl.setGridletStatus(status);
        rgl.finalizeGridlet();
        super.sendFinishGridlet( rgl.getGridlet() );
        allocateQueueGridlet();   // move Queued Gridlet into exec list

        // once a gridlet has finished, then check whether it is time to
        // remove a reservation
        if (rgl.hasReserved())
        {
            int id=super.searchReservation(reservList_,rgl.getReservationID());
            if (id != -1)
            {
                ARObject obj = (ARObject) reservList_.get(id);
                obj.reduceTotalGridlet();

                // if no Gridlets executed or time has already gone
                // then remove it from the list
                long currentTime = super.getCurrentTime();
                long endTime = obj.getStartTime() +
                               (obj.getDurationTime()*MILLI_SEC);
                if (obj.getTotalGridlet() == 0 && currentTime > endTime)
                {
                    obj.setStatus(GridSimTags.AR_STATUS_COMPLETED);
                    expiryList_.add(obj);
                    reservList_.remove(obj);
                }
            }
        }
    }