sirius.biz.locks.LockManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirius-biz Show documentation
Show all versions of sirius-biz Show documentation
Provides a framework for building web based business applications
/*
* Made with all the love in the world
* by scireum in Remshalden, Germany
*
* Copyright by scireum GmbH
* http://www.scireum.de - [email protected]
*/
package sirius.biz.locks;
import sirius.kernel.di.std.Named;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.time.Duration;
import java.util.List;
/**
* Provides an actual implementation to manage locks.
*/
public interface LockManager extends Named {
/**
* Tries to acquire the lock with the given name within the given interval.
*
* @param lockName the name of the lock to acquire.
* @param acquireTimeout the max time to wait for a lock. Used null to immediatelly return if a lock
* cannot
* be obtained.
* @return true if the lock was acquired, false otherwise
*/
boolean tryLock(@Nonnull String lockName, @Nullable Duration acquireTimeout);
/**
* Determines if the lock is currently being locked.
*
* @param lock the name of the lock to check
* @return true if the lock is locked, false otherwise
*/
boolean isLocked(@Nonnull String lock);
/**
* Unlocks the given lock.
*
* @param lock the name of the lock
* @param force true if the lock should be removed, even if it is acquired by another node
*/
void unlock(String lock, boolean force);
/**
* Returns the list of known locks.
*
* @return a list of all available locks
*/
List getLocks();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy