Package org.radargun.stages.tpcc.domain

Examples of org.radargun.stages.tpcc.domain.Warehouse


      String d_name;
      long namecnt;
      String new_c_last;
      String c_data = null, c_new_data, h_data;

      Warehouse w = new Warehouse();
      w.setW_id(w_id);

      boolean found = w.load(basicCache);
      if (!found) throw new ElementNotFoundException("W_ID=" + w_id + " not found!");
      w.setW_ytd(h_amount);
      w.store(basicCache);

      District d = new District();
      d.setD_id(d_id);
      d.setD_w_id(w_id);
      found = d.load(basicCache);
      if (!found) throw new ElementNotFoundException("D_ID=" + d_id + " D_W_ID=" + w_id + " not found!");

      d.setD_ytd(h_amount);
      d.store(basicCache);

      Customer c = null;

      if (c_by_name) {
         new_c_last = c_last;
         List cList = null;
         cList = CustomerDAC.loadByCLast(basicCache, c_w_id, c_d_id, new_c_last);

         if (cList == null || cList.isEmpty())
            throw new ElementNotFoundException("C_LAST=" + c_last + " C_D_ID=" + c_d_id + " C_W_ID=" + c_w_id + " not found!");

         Collections.sort(cList);

         namecnt = cList.size();

         if (namecnt % 2 == 1) namecnt++;
         Iterator<Customer> itr = cList.iterator();

         for (int i = 1; i <= namecnt / 2; i++) {
            c = itr.next();
         }
      } else {
         c = new Customer();
         c.setC_id(c_id);
         c.setC_d_id(c_d_id);
         c.setC_w_id(c_w_id);
         found = c.load(basicCache);
         if (!found)
            throw new ElementNotFoundException("C_ID=" + c_id + " C_D_ID=" + c_d_id + " C_W_ID=" + c_w_id + " not found!");
      }

      c.setC_balance(c.getC_balance() + h_amount);
      if (c.getC_credit().equals("BC")) {

         c_data = c.getC_data();

         c_new_data = c.getC_id() + " " + c_d_id + " " + c_w_id + " " + d_id + " " + w_id + " " + h_amount + " |";
         if (c_data.length() > c_new_data.length()) {
            c_new_data += c_data.substring(0, c_data.length() - c_new_data.length());
         } else {
            c_new_data += c_data;
         }

         if (c_new_data.length() > 500) c_new_data = c_new_data.substring(0, 500);

         c.setC_data(c_new_data);
         c.store(basicCache);
      } else {
         c.store(basicCache);
      }

      w_name = w.getW_name();
      d_name = d.getD_name();

      if (w_name.length() > 10) w_name = w_name.substring(0, 10);
      if (d_name.length() > 10) d_name = d_name.substring(0, 10);
      h_data = w_name + "    " + d_name;
View Full Code Here


      log.info("populate warehouses");
      if (this.numWarehouses > 0) {
         for (int i = 1; i <= this.numWarehouses; i++) {
            log.info(" WAREHOUSE " + i);
            if (this.slaveIndex == 0) {// Warehouse assigned to node 0 if I have more than one node
               Warehouse newWarehouse = new Warehouse(i,
                                                      TpccTools.aleaChainec(6, 10),
                                                      TpccTools.aleaChainec(10, 20), TpccTools.aleaChainec(10, 20),
                                                      TpccTools.aleaChainec(10, 20), TpccTools.aleaChainel(2, 2),
                                                      TpccTools.aleaChainen(4, 4) + TpccTools.CHAINE_5_1,
                                                      TpccTools.aleaFloat(Float.valueOf("0.0000").floatValue(),
                                                                          Float.valueOf("0.2000").floatValue(), 4),
                                                      TpccTools.WAREHOUSE_YTD);

               boolean successful = false;
               while (!successful) {
                  try {
                     newWarehouse.store(basicCache);
                     successful = true;
                  } catch (Throwable e) {
                     log.warn("Storing new warehouse failed", e);
                  }
               }
View Full Code Here

      int s_remote_cnt_increment;
      double ol_amount, total_amount = 0;


      Customer c = new Customer();
      Warehouse w = new Warehouse();

      c.setC_id(c_id);
      c.setC_d_id(d_id);
      c.setC_w_id(w_id);

      boolean found = c.load(basicCache);

      if (!found)
         throw new ElementNotFoundException("W_ID=" + w_id + " C_D_ID=" + d_id + " C_ID=" + c_id + " not found!");

      w.setW_id(w_id);

      found = w.load(basicCache);
      if (!found) throw new ElementNotFoundException("W_ID=" + w_id + " not found!");


      District d = new District();
      // see clause 2.4.2.2 (dot 4)
View Full Code Here

TOP

Related Classes of org.radargun.stages.tpcc.domain.Warehouse

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.