Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Transaction.rollback()


        log.info(jobId + ": Reinitializing job: " + existing);
      }
      return true;
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
    }
  }

  private void scheduleControllerAndMarkActive(ShardedJobStateImpl<T, R> jobState) {
View Full Code Here


      DATASTORE.put(tx, ShardedJobStateImpl.ShardedJobSerializer.toEntity(jobState));
      scheduleControllerTask(tx, jobState);
      tx.commit();
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
    }
    log.info(jobId + ": Started");
  }
View Full Code Here

      jobState.setStatus(Status.ABORTED);
      DATASTORE.put(tx, ShardedJobStateImpl.ShardedJobSerializer.toEntity(jobState));
      tx.commit();
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
    }
  }

}
View Full Code Here

            // commit the transaction if the Closure<?> executed without throwing an exception
            transaction.commit();
        } catch (Exception e) {
            // rollback on error
            if (transaction.isActive()) {
                transaction.rollback();
            }
            // rethrow the exception
            throw e;
        }
        return transaction;
View Full Code Here

            datastoreService.put(transaction, entry.asEntity());
            transaction.commit();
        } finally {
            if (transaction.isActive()) {
                logger.info("Transaction to commit new events is rolled back because");
                transaction.rollback();
            } else {
                if (logger.isDebugEnabled()) {
                    logger.debug("event of type {} appended", type);
                }
            }
View Full Code Here

            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            Transaction tx = ds.beginTransaction();
            try {
                return (ds.getCurrentTransaction() != null);
            } finally {
                tx.rollback();
            }
        } catch (Throwable ignored) {
            return false;
        }
    }
View Full Code Here

            return key;
        } catch (Exception e) {
            throw new IllegalStateException(e);
        } finally {
            if (txn.isActive()) {
                txn.rollback();
            }
        }
    }

    public static <T extends TempData> List<T> getAllTempData(Class<T> type) {
View Full Code Here

            txn.commit();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        } finally {
            if (txn.isActive()) {
                txn.rollback();
            }
        }
    }

    protected static <T extends TempData> String getKind(Class<T> type) {
View Full Code Here

        Transaction tx = ds.beginTransaction();
        try {
            // this one should be part of auto Tx
            k1 = ds.put(new Entity("PutAutoTx"));
        } finally {
            tx.rollback();
        }

        Assert.assertTrue(ds.get(Collections.singleton(k1)).isEmpty());

        k1 = ds.put(new Entity("DeleteAutoTx"));
View Full Code Here

            tx = ds.beginTransaction();
            try {
                // this one should be part of auto Tx
                ds.delete(k1);
            } finally {
                tx.rollback();
            }

            Assert.assertNotNull(ds.get(k1));
        } finally {
            ds.delete(k1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.