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

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

Go to download

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

There is a newer version: 7.3.6
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;
import io.bdeploy.common.util.PathHelper;

/**
 * Resolves an existing lock by deleting the lock file.
 *
 * @see LockDirectoryOperation
 * @see AwaitDirectoryLockOperation
 */
public class ReleaseDirectoryLockOperation extends BHive.Operation {

    private Path directory;

    @Override
    public Void call() throws Exception {
        assertNotNull(directory, "No directory to unlock.");

        PathHelper.deleteRecursive(directory.resolve(LockDirectoryOperation.LOCK_FILE));
        return null;
    }

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy