private void sendReservation(ArrayList resARList, ArrayList resNameList)
    {
        //  total reservation made. 1 reservation reserves 1 PE.
        int totalPE = 1;
        int totalReservation = list_.size();   // total number of Gridlets
        
        // gets the init simulation time
        Calendar cal = GridSim.getSimulationCalendar();

        // wants to reserve 1 day after the init simulation time
        int MILLI_SEC = 1000;
        long time = cal.getTimeInMillis() + (1 * DAY * MILLI_SEC);
        
        // each reservation requires around 10 minutes
        int duration = 10 * MIN;  
                
        String result = null;
        Gridlet gl = null;
        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);
                    
            // 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 = cal.getTimeInMillis() + (1*DAY*MILLI_SEC) 
                            + (duration*MILLI_SEC);
            }
                
            // creates a new or immediate reservation
            result = super.createReservation(time, duration, totalPE, resID);
            System.out.println(super.get_name() + ": reservation result from "+ 
                    resName + " = " + result + " at time = " + GridSim.clock());

            // queries the status of this reservation
            val = super.queryReservation(result);
            System.out.println(super.get_name() + ": query result = " + 
                    AdvanceReservation.getQueryResult(val) );
            
            // if a reservation fails, then continue the next Gridlet
            if (val == GridSimTags.AR_STATUS_ERROR ||
                val == GridSimTags.AR_STATUS_ERROR_INVALID_BOOKING_ID)
            {
                failReservation_++;
                System.out.println("==========================");
                continue;
            }

            // for a reservation with an even number, commits straightaway
            // without sending any Gridlets yet
            if (i % 2 == 0)
            {
                val = super.commitReservation(result);
                System.out.println(super.get_name() + 
                        ": commit only with result = " + 
                        AdvanceReservation.getCommitResult(val) );
            }
            
            // a reservation only needs to reserve 1 PE.
            gl = (Gridlet) list_.get(i);
            val = super.commitReservation(result, gl);
            System.out.println(super.get_name() + ": commit result = " + 
                    AdvanceReservation.getCommitResult(val) );

            // queries the status of this reservation
            val = super.queryReservation(result);
            System.out.println(super.get_name() + ": query result = " + 
                    AdvanceReservation.getQueryResult(val) );
            System.out.println("==========================");
        }
    }