All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.ydb.common.transaction.impl.YdbTransactionImpl Maven / Gradle / Ivy

package tech.ydb.common.transaction.impl;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;

import tech.ydb.common.transaction.TxMode;
import tech.ydb.common.transaction.YdbTransaction;
import tech.ydb.core.Status;

/**
 * @author Nikolay Perfilov
 */
public abstract class YdbTransactionImpl implements YdbTransaction {
    protected final TxMode txMode;
    protected final AtomicReference txId;
    protected final AtomicReference> statusFuture = new AtomicReference<>(
            new CompletableFuture<>());

    protected YdbTransactionImpl(TxMode txMode, String txId) {
        this.txMode = txMode;
        this.txId = new AtomicReference<>(txId);
    }

    @Override
    public String getId() {
        return txId.get();
    }

    @Override
    public TxMode getTxMode() {
        return txMode;
    }

    @Override
    public CompletableFuture getStatusFuture() {
        return statusFuture.get();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy