Interface TimestampLeaseAwareTransaction


@Beta public interface TimestampLeaseAwareTransaction
  • Method Details

    • preCommit

      void preCommit(com.palantir.atlasdb.common.api.timelock.TimestampLeaseName leaseName, int numLeasedTimestamps, TimestampLeaseAwareTransaction.PreCommitAction action)
      Register TimestampLeaseAwareTransaction.PreCommitAction lambdas that are run on Transaction.commit() just before the transaction is closed.

      In the pre-commit lambdas, consumers can perform any actions they would inside a transaction. It is valid, for example, to read to or write from a table.

      If numLeasedTimestamps is greater than 0, fresh timestamps will be fetched from TransactionManager.getTimelockService() and will be provided to the pre-commit lambda via the supplier on Consumer<LongSupplier>.

      Clients can use TimestampLeaseAwareTransactionManager.getLeasedTimestamp(TimestampLeaseName) to fetch a timestamp before the earliest leased timestamp for a given timestampLeaseName on open transactions.

      Parameters:
      leaseName - the name of the lease the timestamps are bound to
      numLeasedTimestamps - the number of timestamps that should be fetched and used in the pre-commit lambda
      action - the lambda executed just before commit. Note the consumer throws RuntimeException if a client requests more than specified in numLeasedTimestamps.