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

io.bdeploy.bhive.op.DirectoryModificationOperation Maven / Gradle / Ivy

Go to download

Public API including dependencies, ready to be used for integrations and plugins.

There is a newer version: 7.4.0
Show newest version
package io.bdeploy.bhive.op;

import static io.bdeploy.common.util.RuntimeAssert.assertNotNull;

import java.nio.file.Path;

import io.bdeploy.bhive.BHive;

public abstract class DirectoryModificationOperation extends BHive.Operation {

    protected static final int RETRIES = 100_000;
    protected static final int SLEEP_MILLIS = 10;
    protected Path directory;

    @Override
    public Void call() throws Exception {
        assertNotNull(directory, "No directory to lock.");
        doCall(directory.resolve(".lock"));
        return null;
    }

    /**
     * Sets the directory that should be locked.
     */
    public DirectoryModificationOperation setDirectory(Path directory) {
        this.directory = directory;
        return this;
    }

    protected abstract void doCall(Path lockFile);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy