com.googlecode.objectify.Objectify.getTransaction()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.googlecode.objectify.Objectify.getTransaction()方法的一些代码示例,展示了Objectify.getTransaction()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objectify.getTransaction()方法的具体详情如下:
包路径:com.googlecode.objectify.Objectify
类名称:Objectify
方法名:getTransaction

Objectify.getTransaction介绍

[英]This used to have meaning in the old GAE SDK but no longer does. Right now this is pretty much only useful as a null test to see if you are currently in a transaction. This method will probably be removed.
[中]这在旧的GAE SDK中曾经有意义,但现在不再有了。现在,这几乎只是一个空测试,用于查看您当前是否在事务中。这种方法可能会被删除。

代码示例

代码示例来源:origin: objectify/objectify

/**
 * 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;
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

public static void closeQuietly(Objectify objectify) {
  if (objectify.getTransaction().isActive())
    objectify.getTransaction().rollback();
}

代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine

public static void commit(Objectify objectify) {
  objectify.getTransaction().commit();
}

代码示例来源:origin: instacount/appengine-counter

@VisibleForTesting
protected boolean isParentTransactionActive()
{
  return ObjectifyService.ofy().getTransaction() == null ? false
    : ObjectifyService.ofy().getTransaction().isActive();
}

代码示例来源:origin: com.threewks.thundr/thundr-gae

@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());
  }
}

代码示例来源:origin: bedatadriven/activityinfo

ColumnBlockUpdater blockUpdater = new ColumnBlockUpdater(rootEntity, formClass, Hrd.ofy().getTransaction());

相关文章