private void handleCancelReservation(Sim_event ev)
    {
        int src = -1;   // sender id
        boolean success = false;
        int tag = -1;

        try
        {
            // id[0] = gridletID, [1] = reservID, [2] = transID, [3] = sender ID
            int[] obj = ( int[] ) ev.get_data();

            // get the data inside an array
            int reservationID = obj[1];
            int transactionID = obj[2];
            src = obj[3];

            // gridletID can be -1 if want to cancel ALL Gridlets in 1 reserv
            int gridletID = obj[0];
            int returnTag = GridSimTags.RETURN_AR_CANCEL;
            tag = returnTag + transactionID;

            // check whether this resource can support AR or not
            success = checkResourceType(src, returnTag, transactionID,
                            GridSimTags.AR_CANCEL_ERROR_RESOURCE_CANT_SUPPORT,
                            "can't cancel a reservation");

            if (!success) {
                return;
            }

            // cancels a gridlet of a specific reservation
            else if (success && gridletID != -1)
            {
                ( (ARPolicy) policy_).handleCancelReservation(reservationID,
                                            src, gridletID, tag);
            }

            // cancels ALL gridlets of a specific reservation
            else if (success && gridletID == -1)
            {
                ( (ARPolicy) policy_).handleCancelReservation(reservationID,
                                            src, tag);
            }
        }
        catch (ClassCastException c)
        {
            // cancel a list of Gridlets
            handleCancelList(ev);
            return;
        }
        catch (Exception e) {
            success = false;
        }

        // if there is an exception, then send back an error msg
        if (!success && tag != -1)
        {
            System.out.println(super.get_name() + " : Error - can't cancel a "+
                "new reservation.");

            super.send(src, 0.0, GridSimTags.RETURN_AR_CANCEL,
                new IO_data(new Integer(GridSimTags.AR_CANCEL_ERROR),SIZE,src));
        }
    }