public Collection<TimeSlot> queryFreeTime(double startTime, 
    		int duration, int resID) {

    	// check all the values first
        boolean success = validateValue(startTime, duration, 1);
        if (!success) {
            return null;
        }
        
        Collection<TimeSlot> resOptions = null;
        try {
        	
        	// create the reservation itself
        	Reservation reservation = new Reservation(super.get_id());
        	reservation.setStartTime(startTime);
        	reservation.setDurationTime(duration);
        	reservation.setResourceID(resID);
        	
        	// creates the message to be sent to the grid resource
        	ReservationMessage message = new ReservationMessage(super.get_id(), resID, reservation);
        	message.setMessageType(MessageType.LIST_FREE_TIME);
        	
            // gets the reply from the grid resource
        	ReservationMessage reply = sendReservationMessage(message);
            
        	// If error code is NO_ERROR, the reservation has been successful.
            ErrorType error = (reply == null) ? 
            		ErrorType.OPERATION_FAILURE : reply.getErrorCode();
            
            if(error == ErrorType.NO_ERROR && reply != null) {
            	resOptions = reply.getReservation().getReservationOptions();
            }
            else {
            	logger.info("Resource # " + resID + " could not inform the " +
            			"availability at time " + GridSim.clock());
            	resOptions = null;
            }
        }
        
        catch (Exception ex) {
        	logger.log(Level.WARNING,"Resource # " + resID +
        			" could not inform the availability at time " + GridSim.clock(), ex);
        	resOptions = null;
        }
        
        return resOptions;
    }