org.infinispan.util.concurrent.locks.LockManager Maven / Gradle / Ivy
package org.infinispan.util.concurrent.locks;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.InvocationContext;
import org.infinispan.util.concurrent.TimeoutException;
import java.util.Collection;
/**
* An interface to deal with all aspects of acquiring and releasing locks for cache entries.
*
* @author Manik Surtani ([email protected])
* @author [email protected]
* @since 4.0
*/
public interface LockManager {
/**
* Acquires a lock of type lockType, on a specific entry in the cache. This method will try for a period of time and
* give up if it is unable to acquire the required lock. The period of time is specified in {@link
* org.infinispan.config.Configuration#getLockAcquisitionTimeout()}.
*
*
*
* @param key key to lock
* @param ctx invocation context associated with this invocation
* @return true if the lock was acquired, false otherwise.
* @throws InterruptedException if interrupted
*/
boolean lockAndRecord(Object key, InvocationContext ctx, long timeoutMillis) throws InterruptedException;
/**
* Releases the lock passed in.
*/
void unlock(Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy