Search in sources :

Example 1 with StoreSubTimer

use of com.apple.foundationdb.record.provider.common.StoreSubTimer in project fdb-record-layer by FoundationDB.

the class FDBDatabase method createTransaction.

/**
 * Creates a new transaction against the database.
 *
 * @param executor the executor to be used for asynchronous operations
 * @return newly created transaction
 */
private Transaction createTransaction(@Nonnull FDBRecordContextConfig config, @Nonnull Executor executor) {
    final TransactionListener listener = config.getTransactionListener() == null ? factory.getTransactionListener() : config.getTransactionListener();
    final StoreTimer timer = listener != null ? new StoreSubTimer(config.getTimer()) : config.getTimer();
    boolean enableAssertions = config.areAssertionsEnabled();
    // noinspection ConstantConditions
    Transaction transaction = database.createTransaction(executor, new EventKeeperTranslator(timer));
    if (timer != null || enableAssertions) {
        transaction = new InstrumentedTransaction(timer, this, listener, transaction, enableAssertions);
    }
    return transaction;
}
Also used : StoreTimer(com.apple.foundationdb.record.provider.common.StoreTimer) Transaction(com.apple.foundationdb.Transaction) StoreSubTimer(com.apple.foundationdb.record.provider.common.StoreSubTimer)

Aggregations

Transaction (com.apple.foundationdb.Transaction)1 StoreSubTimer (com.apple.foundationdb.record.provider.common.StoreSubTimer)1 StoreTimer (com.apple.foundationdb.record.provider.common.StoreTimer)1