Package com.oltpbenchmark.benchmarks.seats.util

Examples of com.oltpbenchmark.benchmarks.seats.util.CustomerId


        results = stmt.executeQuery();
        found = results.next();
        results.close();
        if (found == false) {
            throw new UserAbortException(ErrorType.INVALID_CUSTOMER_ID +
                                         String.format(" Invalid customer id: %d / %s", c_id, new CustomerId(c_id)));
        }
       
        stmt = this.getPreparedStatement(conn, InsertReservation);
        stmt.setLong(1, r_id);
        stmt.setLong(2, c_id);
View Full Code Here


                    while (airport_id == null) {
                        this.airport_code = this.rand.nextValue();
                        airport_id = profile.getAirportId(this.airport_code);
                    } // WHILE
                    int next_customer_id = profile.incrementAirportCustomerCount(airport_id);
                    this.last_id = new CustomerId(next_customer_id, airport_id);
                    if (LOG.isTraceEnabled()) LOG.trace("NEW CUSTOMER: " + this.last_id.encode() + " / " + this.last_id);
                    value = this.last_id.encode();
                    if (LOG.isTraceEnabled()) LOG.trace(value + " => " + this.airport_code + " [" + profile.getCustomerIdCount(airport_id) + "]");
                    break;
                }
View Full Code Here

                    m.put(String.format("Returning Customers[%d]", returning_customers.size()), StringUtil.join("\n", returning_customers));
                    LOG.trace("Flight Information\n" + StringUtil.formatMaps(m));
                }
               
                for (int seatnum = 0; seatnum < booked_seats; seatnum++) {
                    CustomerId customer_id = null;
                    Integer airport_customer_cnt = profile.getCustomerIdCount(depart_airport_id);
                    boolean local_customer = airport_customer_cnt != null && (flight_customer_ids.size() < airport_customer_cnt.intValue());
                    int tries = 2000;
                    ReturnFlight return_flight = null;
                    while (tries > 0) {
View Full Code Here

     */
    public CustomerId getRandomCustomerId(Long airport_id) {
        Integer cnt = this.getCustomerIdCount(airport_id);
        if (cnt != null) {
            int base_id = rng.nextInt(cnt.intValue());
            return (new CustomerId(base_id, airport_id));
        }
        return (null);
    }
View Full Code Here

     */
    public CustomerId getRandomCustomerId() {
        int num_airports = this.airport_max_customer_id.getValueCount();
        if (LOG.isTraceEnabled())
            LOG.trace(String.format("Selecting a random airport with customers [numAirports=%d]", num_airports));
        CustomerId c_id = null;
        while (c_id == null) {
            Long airport_id = (long)this.rng.number(1, num_airports);
            c_id = this.getRandomCustomerId(airport_id);
        } // WHILE
        return (c_id);
View Full Code Here

            Integer seatnum = (Integer)row[1];
         
            // We first try to get a CustomerId based at this departure airport
            if (LOG.isTraceEnabled())
                LOG.trace("Looking for a random customer to fly on " + search_flight);
            CustomerId customer_id = profile.getRandomCustomerId(airport_depart_id);
         
            // We will go for a random one if:
            //  (1) The Customer is already booked on this Flight
            //  (2) We already made a new Reservation just now for this Customer
            int tries = SEATSConstants.FLIGHTS_NUM_SEATS;
View Full Code Here

    // UpdateCustomer
    // ----------------------------------------------------------------
   
    private boolean executeUpdateCustomer(UpdateCustomer proc) throws SQLException {
        // Pick a random customer and then have at it!
        CustomerId customer_id = this.profile.getRandomCustomerId();
       
        Long c_id = null;
        String c_id_str = null;
        long attr0 = this.rng.nextLong();
        long attr1 = this.rng.nextLong();
        long update_ff = (rng.number(1, 100) <= SEATSConstants.PROB_UPDATE_FREQUENT_FLYER ? 1 : 0);
       
        // Update with the Customer's id as a string
        if (rng.nextInt(100) < SEATSConstants.PROB_UPDATE_WITH_CUSTOMER_ID_STR) {
            c_id_str = Long.toString(customer_id.encode());
        }
        // Update using their Customer id
        else {
            c_id = customer_id.encode();
        }

        if (LOG.isTraceEnabled()) LOG.trace("Calling " + proc);
        proc.run(conn, c_id, c_id_str, update_ff, attr0, attr1);
        conn.commit();
View Full Code Here

TOP

Related Classes of com.oltpbenchmark.benchmarks.seats.util.CustomerId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.