Example #1
0
 public static void printCustomerBills(ResourceManagerImpl rm)
     throws RemoteException, TransactionAbortedException, InvalidTransactionException {
   int xid = rm.start();
   for (String cust : customers) {
     int bill = rm.queryCustomerBill(xid, cust);
     System.out.println("Bill for " + cust + " : " + bill);
   }
   int bill = rm.queryCustomerBill(xid, "Joe");
   System.out.println("Bill for " + "Joe" + " : " + bill);
   rm.commit(xid);
 }
Example #2
0
  public static void Baddcmtrd(ResourceManagerImpl rm)
      throws RemoteException, TransactionAbortedException, InvalidTransactionException {
    int xid = rm.start();
    rm.addFlight(xid, "347", 100, 310);
    rm.addRooms(xid, "Stanford", 200, 150);
    rm.addCars(xid, "SFO", 300, 30);
    rm.newCustomer(xid, "John");
    rm.commit(xid);
    // printTables(rm);

    xid = rm.start();
    int avail = rm.queryFlight(xid, "347");
    System.out.println(avail);
    avail = rm.queryFlightPrice(xid, "347");
    System.out.println(avail);
    avail = rm.queryRooms(xid, "Stanford");
    System.out.println(avail);
    avail = rm.queryRoomsPrice(xid, "Stanford");
    System.out.println(avail);
    avail = rm.queryCars(xid, "SFO");
    System.out.println(avail);
    avail = rm.queryCarsPrice(xid, "SFO");
    System.out.println(avail);
    avail = rm.queryCustomerBill(xid, "John");
    System.out.println(avail);
  }