CallEvent[] makeRandomEvent() {
        long callId = ++lastCallIdUsed;

        // get agentid
        Integer agentId = agentsAvailable.poll();
        if (agentId == null) {
            return null;
        }

        // get phone number
        Long phoneNo = phoneNumbersAvailable.poll();
        assert(phoneNo != null);

        // voltdb timestamp type uses micros from epoch
        Date startTS = new Date(currentSystemMilliTimestamp);

        long durationms = -1;
        long meancalldurationms = config.meancalldurationseconds * 1000;
        long maxcalldurationms = config.maxcalldurationseconds * 1000;
        double stddev = meancalldurationms / 2.0;

        // repeat until in the range (0..maxcalldurationms]
        while ((durationms <= 0) || (durationms > maxcalldurationms)) {
            durationms = (long) (rand.nextGaussian() * stddev) + meancalldurationms;
        }
        Date endTS = new Date(startTS.getTime() + durationms);

        CallEvent[] event = new CallEvent[2];
        event[0] = new CallEvent(callId, agentId, phoneNo, startTS, null);
        event[1] = new CallEvent(callId, agentId, phoneNo, null, endTS);

        // some debugging code
        //System.out.println("Creating event with range:");
        //System.out.println(new Date(startTS.getTime() / 1000));
        //System.out.println(new Date(endTS.getTime() / 1000));

        return event;
    }
CallEvent [ ] makeRandomEvent ( ) { long callId = ++ lastCallIdUsed ; Integer agentId = agentsAvailable . poll ( ) ; if ( agentId == null ) { return null ; } Long phoneNo = phoneNumbersAvailable . poll ( ) ; assert ( phoneNo != null ) ; Date startTS = new Date ( currentSystemMilliTimestamp ) ; long durationms = - 1 ; long meancalldurationms = config . meancalldurationseconds * 1000 ; long maxcalldurationms = config . maxcalldurationseconds * 1000 ; double stddev = meancalldurationms / 2.0 ; while ( ( durationms <= 0 ) || ( durationms > maxcalldurationms ) ) { durationms = ( long ) ( rand . nextGaussian ( ) * stddev ) + meancalldurationms ; } Date endTS = new Date ( startTS . getTime ( ) + durationms ) ; CallEvent [ ] event = new CallEvent [ 2 ] ; event [ 0 ] = new CallEvent ( callId , agentId , phoneNo , startTS , null ) ; event [ 1 ] = new CallEvent ( callId , agentId , phoneNo , null , endTS ) ; return event ; }
Generate a random call event with a duration.

Reserves agent and phone number from the pool.