private void sendReservation(ArrayList resARList, ArrayList resNameList) {
        //  total reservation made.
        int totalPE = 3;
        int totalReservation = jobs.size() + 2;   // total number of Gridlets
        
        // wants to reserve 1 hour after the init simulation time
        long time = 1 * HOUR;
        
        // each reservation requires around 10 minutes
        int duration = 10 * MIN;  
                
        int val = 0;
        int resID = 0;   // a resource ID
        int totalResource = resARList.size();   // total AR resource available
        String resName = null;
        
        Random randObj = new Random(time);
        
        for (int i = 0; i < totalReservation; i++) {
            duration += 5 * MIN;   // duration of a reservation
                
            // gets the resource ID and name
            val = randObj.nextInt(totalResource);
            resID = ( (Integer) resARList.get(val) ).intValue(); 
            resName = (String) resNameList.get(val);

            // queries the availability of the Grid resource
            Collection<TimeSlot> availability = 
            	super.queryFreeTime(GridSim.clock(), Integer.MAX_VALUE, resID);
            
            System.out.println("Availability information returned by the " +
            		"Grid resource # " + resID + " at time # " + GridSim.clock() + 
            		" is as follows: \n " + availability);
            
            // try immediate reservation, where starting time is 0 meaning
            // use current time as the start time
            if (val == i) {
                time = 0;   // immediate reservation
            }
            else {
                time = 1 * HOUR + duration;
            }
            
            // creates a new reservation
            Reservation rsv = null;
            boolean success = false;
            
            rsv = super.createReservation(time, duration, totalPE, resID);
            if(rsv != null && rsv.getStatus() != ReservationStatus.FAILED) {
	            System.out.println(super.get_name() + ": reservation has been accepted by "+ 
	                    resName + " at time = " + GridSim.clock());
	            success = true;
            }
            else {
            	System.out.println(super.get_name() + ": reservation has not been accepted by "+ 
	                    resName + " at time = " + GridSim.clock());
                failReservation++;
                success = false;
            }

            // confirm the reservation
            if(success) {
            	
            	// query the status of the reservation
            	ReservationStatus status = super.queryReservation(rsv.getID());
            	System.out.println("The status of reservation # " + rsv.getID() +
            			" is # " + status.getDescription());
            	
	            // for a reservation with an even number, commits straight away
	            // without sending any jobs yet
	            success = super.commitReservation(rsv.getID());
	            
	            if(success) {
	                System.out.println("Reservation # "+ rsv.getID() + 
	                		" has been confirmed successfully.");
	            }
	            else {
	                System.out.println("Reservation # "+ rsv.getID() + 
	                	" has NOT been confirmed successfully.");
	            }

            	// query the status of the reservation again
            	status = super.queryReservation(rsv.getID());
            	System.out.println("The status of reservation # " + rsv.getID() +
            			" is # " + status.getDescription());
            }
            
            if(success && i<jobs.size()) {
	            // then sends a gridlet to use the reservation
	            Gridlet grl = this.jobs.get(i);
	            grl.setReservationID(rsv.getID());
	            super.gridletSubmit(grl, resID);
            }
        }
    }