Package ch.ethz.vs.rowa

Examples of ch.ethz.vs.rowa.UpdateFuture


     
      try {
        UUID id = middleware.startTransaction();
       
        QueryFuture qf = new QueryFuture();
        UpdateFuture uf = new UpdateFuture();

        // TODO: start measurement
       
        middleware.executeQuery(id, qf, "1st client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();
       
        // TODO: end measurement
        // TODO: add if failed

        middleware.executeQuery(id, qf, "2nd client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();
       
        middleware.executeUpdate(id, uf, "1st client "+item+" UPDATE execute");
        while(!uf.isDone()) { Thread.yield(); }
        uf.getResult();
        uf.reset();
       
        middleware.executeQuery(id, qf, "3th client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();

        middleware.executeUpdate(id, uf, "second client "+item+" UPDATE execute");
        while(!uf.isDone()) { Thread.yield(); }
        uf.getResult();
        uf.reset();
       
        middleware.commitTransaction(id);
       
      } catch (MiddlewareException e) {
        // TODO Auto-generated catch block
View Full Code Here


    }, "SELECT * FROM shopping_cart WHERE sc_id = " + sc_id);

    // Here you get sometimes an abort, since two workers try to insert the same shopping_cart
//    if (res.length == 0)
//    {
    UpdateFuture uf = new UpdateFuture();
    mw.executeUpdate(transactionUuid, uf, "INSERT INTO shopping_cart (sc_id, sc_c_id, sc_total) VALUES ("
    + sc_id + "," + GENERATOR.nextInt(20000) + ", 0)");
//    }

    mw.executeQuery(transactionUuid, new QueryFuture() {
      public void onResult(String[][] result) {
      }
    }, "SELECT scl_qty FROM shopping_cart_line WHERE scl_sc_id = "
    + sc_id + " AND scl_i_id =" + i_id);

//    if (res.length == 0)
//    {
    mw.executeUpdate(transactionUuid, new UpdateFuture() {
      public void onResult(int result) {
      }
    }, "INSERT into shopping_cart_line (scl_sc_id, scl_qty, scl_i_id) VALUES ("
    + sc_id + ",1," + i_id + ")");
//    }
//    else
//    {
//      mw.executeUpdate("UPDATE shopping_cart_line SET scl_qty = " + generator.nextInt(20) + " WHERE scl_sc_id = "
//          + sc_id + " AND scl_i_id = " + i_id);
//    }

    mw.executeUpdate(transactionUuid, new UpdateFuture() {
      public void onResult(int result) {
      }
    }, "UPDATE shopping_cart SET sc_date = current_timestamp WHERE sc_id = " + sc_id);

    mw.commitTransaction(transactionUuid);
View Full Code Here

      {
        boolean success = false;
        long time = (new Date()).getTime();
        UUID id;
        int item = 1;
        UpdateFuture uf = new UpdateFuture();
        try {
         
          id = middleware.startTransaction();
          if (id == null) {
            success = false;
          } else {
            middleware.executeUpdate(id, uf, "1st client "+item+" UPDATE execute");
            while(!uf.isDone()) { Thread.yield(); }
             
            if(uf.isSuccess())
            {
              uf.getResult();
              uf.reset();
              success = true;
            }
            else
            {
              success = false;
View Full Code Here

    public void run() {
      try {
        UUID id = middleware.startTransaction();
       
        QueryFuture qf = new QueryFuture();
        UpdateFuture uf = new UpdateFuture();

        // TODO: start measurement
       
        middleware.executeQuery(id, qf, "1st client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();
       
        // TODO: end measurement
        // TODO: add if failed

        middleware.executeQuery(id, qf, "2nd client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();
       
        middleware.executeUpdate(id, uf, "1st client "+item+" UPDATE execute");
        while(!uf.isDone()) { Thread.yield(); }
        uf.getResult();
        uf.reset();
       
        middleware.executeQuery(id, qf, "3th client "+item+" QUERY execute");
        while(!qf.isDone()) { Thread.yield(); }
        qf.getResult();
        qf.reset();

        middleware.executeUpdate(id, uf, "second client "+item+" UPDATE execute");
        while(!uf.isDone()) { Thread.yield(); }
        uf.getResult();
        uf.reset();
       
        middleware.commitTransaction(id);
       
      } catch (MiddlewareException e) {
        // TODO Auto-generated catch block
View Full Code Here

TOP

Related Classes of ch.ethz.vs.rowa.UpdateFuture

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.