public boolean commitReservation(int reservId) {
    	 Reservation reservation = getReservation(reservId);
     	if(reservation == null) {
     		logger.info("Error commiting reservation, ID is invalid");
         	return false;
     	}

     	int resId = reservation.getResourceID();
     	
         try {
 	        
 	        // creates the message to be sent to the grid resource
 	    	ReservationMessage message = new ReservationMessage(super.get_id(), resId, reservation);
 	    	message.setMessageType(MessageType.COMMIT);
 	    	
 	        // 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.getErrorCode();
 	        if(error == ErrorType.NO_ERROR) {
 	        	return true;
 	        }
 	        else {
 	        	logger.info("Reservation # " + reservId +
 	        		" has NOT been committed successfully.");
 	        }
         }
         catch (Exception ex) {
        	 logger.log(Level.WARNING, "Reservation # " + reservId +
	 	        		" has NOT been committed successfully.", ex);
         }
     	return false;
     }