com.palantir.atlasdb.transaction.api.Transaction.setTransactionType()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(87)

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

Transaction.setTransactionType介绍

暂无

代码示例

代码示例来源:origin: palantir/atlasdb

@Override
public void setTransactionType(TransactionType transactionType) {
  delegate().setTransactionType(transactionType);
}

代码示例来源:origin: palantir/atlasdb

@Override
  public void run(
      TransactionManager txManager,
      TableReference tableRef,
      Set<Cell> cells,
      TransactionType transactionType) {
    Collection<OnCleanupTask> nextTasks = cleanupTasksByTable.get(tableRef);
    while (!nextTasks.isEmpty()) {
      final Collection<OnCleanupTask> cleanupTasks = nextTasks;
      nextTasks = txManager.runTaskWithRetry(tx -> {
        Collection<OnCleanupTask> toRetry = Lists.newArrayList();
        Preconditions.checkArgument(transactionType == TransactionType.HARD_DELETE
            || transactionType == TransactionType.AGGRESSIVE_HARD_DELETE);
        tx.setTransactionType(transactionType);
        for (OnCleanupTask task : cleanupTasks) {
          boolean needsRetry = task.cellsCleanedUp(tx, cells);
          if (needsRetry) {
            toRetry.add(task);
          }
        }
        return toRetry;
      });
    }
  }
}

代码示例来源:origin: palantir/atlasdb

private <T> T runWithRetry(Transaction.TransactionType type, Function<ProfileStore, T> task) {
  return txnMgr.runTaskWithRetry(txn -> {
    txn.setTransactionType(type);
    ProfileStore store = new ProfileStore(txnMgr, txn);
    return task.apply(store);
  });
}

代码示例来源:origin: com.palantir.atlasdb/atlasdb-client

@Override
public void setTransactionType(TransactionType transactionType) {
  delegate().setTransactionType(transactionType);
}

代码示例来源:origin: com.palantir.atlasdb/atlasdb-impl-shared

@Override
  public void run(
      TransactionManager txManager,
      TableReference tableRef,
      Set<Cell> cells,
      TransactionType transactionType) {
    Collection<OnCleanupTask> nextTasks = cleanupTasksByTable.get(tableRef);
    while (!nextTasks.isEmpty()) {
      final Collection<OnCleanupTask> cleanupTasks = nextTasks;
      nextTasks = txManager.runTaskWithRetry(tx -> {
        Collection<OnCleanupTask> toRetry = Lists.newArrayList();
        Preconditions.checkArgument(transactionType == TransactionType.HARD_DELETE
            || transactionType == TransactionType.AGGRESSIVE_HARD_DELETE);
        tx.setTransactionType(transactionType);
        for (OnCleanupTask task : cleanupTasks) {
          boolean needsRetry = task.cellsCleanedUp(tx, cells);
          if (needsRetry) {
            toRetry.add(task);
          }
        }
        return toRetry;
      });
    }
  }
}

相关文章