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

com.yahoo.config.provision.ApplicationTransaction Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;

import com.yahoo.transaction.NestedTransaction;

import java.io.Closeable;
import java.util.Objects;

/**
 * A transaction which exists while holding the application provision lock.
 *
 * @author bratseth
 */
public class ApplicationTransaction implements Closeable {

    private final ApplicationMutex lock;
    private final NestedTransaction transaction;

    public ApplicationTransaction(ApplicationMutex lock, NestedTransaction transaction) {
        this.lock = Objects.requireNonNull(lock);
        this.transaction = Objects.requireNonNull(transaction);
    }

    public ApplicationId application() { return lock.application(); }

    /** Returns the NestedTransaction of this */
    public NestedTransaction nested() { return transaction; }

    @Override
    public void close() {
        lock.close();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy