diff --git a/carRentalLabSessions_v6/src/main/java/ds/gae/Worker.java b/carRentalLabSessions_v6/src/main/java/ds/gae/Worker.java index 48d807a..92e1898 100644 --- a/carRentalLabSessions_v6/src/main/java/ds/gae/Worker.java +++ b/carRentalLabSessions_v6/src/main/java/ds/gae/Worker.java @@ -53,11 +53,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S } private void confirmQuotes(List quotes) throws ReservationException { - Transaction tx = ds.newTransaction(); - List reslist = new ArrayList(); - try { - for (Quote quote : quotes) { -// confirmQuoteTx(quote, tx); + for (Quote quote : quotes) { Transaction tx1 = ds.newTransaction(); try { Key crcKey = ds.newKeyFactory().setKind("CarRentalCompany").newKey(quote.getRentalCompany()); @@ -71,25 +67,14 @@ private void confirmQuotes(List quotes) throws ReservationException { } finally { if (tx1.isActive()) { tx1.rollback(); - //for (Entity e:reslist) { - //ds.delete(e.getKey()); - //} + for (Entity e:reslist) { + ds.delete(e.getKey()); + } throw new ReservationException("Quote unavailable. Booking failed, rollback all reservations. "); } - }} - tx.commit(); - } finally { - if (tx.isActive()) { - tx.rollback(); - for (Entity e:reslist) { - ds.delete(e.getKey()); - } - throw new ReservationException("Outer transaction unavailable. Booking failed, rollback all reservations. "); } - } - } public void confirmQuoteTx(Quote quote, Transaction tx) throws ReservationException {