public int queryReservation(String bookingID)
    {
        // id[0] = resID, [1] = reservID, [2] = trans ID
        int[] id = parseBookingID(bookingID);
        if (id == null) {
            return GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID;
        }

        // search from the list first
        ARObject obj = searchBooking(id[0], id[1]);
        if (obj == null) {
            return GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID;
        }

        // if a reservation hasn't been committed
        else if (!obj.hasCommitted()) {
            return GridSimTags.AR_STATUS_NOT_COMMITTED;
        }

        // if the reservation status is one of the final states, then no need
        // to enquiry a resource
        int status = obj.getStatus();

        // if a reservation has been committed, then need to ask a resource
        id[2] = incrementID();   // transaction id
        id[3] = super.get_id();

        // send to grid resource to query about the reservation id
        super.send(super.output, 0.0, GridSimTags.SEND_AR_QUERY,
                   new IO_data(id, SIZE_ARRAY, id[0]) );

        // waiting for a response from the GridResource
        FilterResult tag = new FilterResult(id[2], GridSimTags.RETURN_AR_QUERY_STATUS);

        // only look for this type of ack for same reservation ID
        Sim_event ev = new Sim_event();
        super.sim_get_next(tag, ev);

        // get the result back from GridResource or AllocPolicy object
        try
        {
            int[] array = (int[]) ev.get_data(); // [0] = trans ID, [1] = result
            status = array[1];
        }
        catch (Exception e) {
            status = GridSimTags.AR_STATUS_ERROR;
        }

        obj.setStatus(status);   // put the latest status
        return status;
    }