// NewBid
// ----------------------------------------------------------------
protected boolean executeNewBid(NewBid proc) throws SQLException {
Timestamp benchmarkTimes[] = this.getTimestampParameterArray();
ItemInfo itemInfo = null;
UserId sellerId;
UserId buyerId;
double bid;
double maxBid;
boolean has_available = (profile.getAvailableItemsCount() > 0);
boolean has_ending = (profile.getEndingSoonItemsCount() > 0);
boolean has_waiting = (profile.getWaitForPurchaseItemsCount() > 0);
boolean has_completed = (profile.getCompleteItemsCount() > 0);
// Some NewBids will be for items that have already ended.
// This will simulate somebody trying to bid at the very end but failing
if ((has_waiting || has_completed) &&
(profile.rng.number(1, 100) <= AuctionMarkConstants.PROB_NEWBID_CLOSED_ITEM || has_available == false)) {
if (has_waiting) {
itemInfo = profile.getRandomWaitForPurchaseItem();
assert(itemInfo != null) : "Failed to get WaitForPurchase itemInfo [" + profile.getWaitForPurchaseItemsCount() + "]";
} else {
itemInfo = profile.getRandomCompleteItem();
assert(itemInfo != null) : "Failed to get Completed itemInfo [" + profile.getCompleteItemsCount() + "]";
}
sellerId = itemInfo.getSellerId();
buyerId = profile.getRandomBuyerId(sellerId);
// The bid/maxBid do not matter because they won't be able to actually
// update the auction
bid = profile.rng.nextDouble();
maxBid = bid + 100;
}
// Otherwise we want to generate information for a real bid
else {
assert(has_available || has_ending);
// 50% of NewBids will be for items that are ending soon
if ((has_ending && profile.rng.number(1, 100) <= AuctionMarkConstants.PROB_NEWBID_CLOSED_ITEM) || has_available == false) {
itemInfo = profile.getRandomEndingSoonItem(true);
}
if (itemInfo == null) {
itemInfo = profile.getRandomAvailableItem(true);
}
if (itemInfo == null) {
itemInfo = profile.getRandomItem();
}
sellerId = itemInfo.getSellerId();
buyerId = profile.getRandomBuyerId(sellerId);
double currentPrice = itemInfo.getCurrentPrice();
bid = profile.rng.fixedPoint(2, currentPrice, currentPrice * (1 + (AuctionMarkConstants.ITEM_BID_PERCENT_STEP / 2)));
maxBid = profile.rng.fixedPoint(2, bid, (bid * (1 + (AuctionMarkConstants.ITEM_BID_PERCENT_STEP / 2))));
}
Object results[] = proc.run(conn, benchmarkTimes, itemInfo.itemId.encode(),