Package com.vmware.example.sqlfire.util

Examples of com.vmware.example.sqlfire.util.SimpleStopWatch


  @Transactional
  public synchronized Response runRequest(Request request) {
    logger.debug("Request: " + request);

    // Start timer
    SimpleStopWatch watch = new SimpleStopWatch(true);

    List<Order> orders = new ArrayList<Order>();

    for (int j = 0; j < request.getOrders(); j++) {

      Order order = new Order();
      order.setOn(timestampGenerator.getNow());
      String oId = request.getId() + "-" + request.getIndex() + "-" + j;
      order.setId(oId);

      for (int i = 0; i < request.getItems(); i++) {
        OrderItem item = new OrderItem();
        item.setName(ITEM_NAME_PREFIX + i);
        item.setPrice(new BigDecimal(i));
        item.setId(oId + "-" + i);
        order.getItems().add(item);
      }

      logger.debug("Saving Order: " + order);
      dao.saveOder(request, order);

      orders.add(order);

    }

    logger.debug("Delete Orders and Order Items for: " + request);
    for (Order order : orders) {
      logger.debug("Delete Order Items: " + order.getId());
      dao.removeOderItems(order.getId());

      logger.debug("Delete Order: " + request.getId());
      dao.removeOders(request.getId());
    }

    // Stop timer
    watch.stop();

    // returns stats only for the current call
    // summary from the seperate call
    Request storeRequest = dao.getRequest(request.getId());
    storeRequest.setOrders(request.getOrders());
    storeRequest.setItems(request.getItems());
    storeRequest.setDuration(watch.getDuration());

    logger.debug("Update Duration: " + storeRequest);
    dao.updateRequestDuration(storeRequest);

    logger.debug("Fetching Response: " + storeRequest);
View Full Code Here

TOP

Related Classes of com.vmware.example.sqlfire.util.SimpleStopWatch

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.