/** * Get the current objectify instance associated with this ref */ private Objectify ofy() { // If we have an expired transaction context, we need a new context if (ofy == null || (ofy.getTransaction() != null && !ofy.getTransaction().isActive())) ofy = ObjectifyService.ofy(); return ofy; }
public static void closeQuietly(Objectify objectify) { if (objectify.getTransaction().isActive()) objectify.getTransaction().rollback(); }
public static void commit(Objectify objectify) { objectify.getTransaction().commit(); }
@VisibleForTesting protected boolean isParentTransactionActive() { return ObjectifyService.ofy().getTransaction() == null ? false : ObjectifyService.ofy().getTransaction().isActive(); }
@Override public UUID queue(Job job) { try { JobStatus jobStatus = new JobStatus(); UUID id = jobStatus.getId(); TaskOptions taskOptions = createTaskOptions(job, id); Queue queue = getQueue(job); Transaction transaction = ofy().getTransaction(); queue.add(transaction, taskOptions); ofy().save().entity(jobStatus); return id; } catch (Exception e) { throw new JobException(e, "Failed to queue job: %s", e.getMessage()); } }
ColumnBlockUpdater blockUpdater = new ColumnBlockUpdater(rootEntity, formClass, Hrd.ofy().getTransaction());