Example #1
0
  public static void newBids(Long id) {
    // count new bids
    long newBids =
        Bid.count(
            "from AuctionItem a join a.bids as b " + "where a.id = ? AND b.date > ?",
            id,
            request.date);

    // wait if needed
    if (newBids == 0) {
      await("1s");
    }

    // return the JSON output of the new bids
    AuctionItem item = AuctionItem.findById(id);

    JsonObject json = new JsonObject();
    json.addProperty("next", item.getNextBidPrice());
    json.addProperty("top", item.getCurrentTopBid());
    renderJSON(json.toString());
  }