org.infinispan.util.concurrent.locks.containers.ReentrantStripedLockContainer Maven / Gradle / Ivy
package org.infinispan.util.concurrent.locks.containers;
import net.jcip.annotations.ThreadSafe;
import org.infinispan.commons.equivalence.Equivalence;
import org.infinispan.util.concurrent.locks.VisibleOwnerReentrantLock;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
/**
* A LockContainer that holds ReentrantLocks
*
* @author Manik Surtani ([email protected])
* @see OwnableReentrantStripedLockContainer
* @since 4.0
*/
@ThreadSafe
public class ReentrantStripedLockContainer extends AbstractStripedLockContainer {
private final VisibleOwnerReentrantLock[] sharedLocks;
private static final Log log = LogFactory.getLog(ReentrantStripedLockContainer.class);
@Override
protected Log getLog() {
return log;
}
/**
* Creates a new LockContainer which uses a certain number of shared locks across all elements that need to be
* locked.
*
* @param concurrencyLevel concurrency level for number of stripes to create. Stripes are created in powers of two,
* with a minimum of concurrencyLevel created.
*/
public ReentrantStripedLockContainer(int concurrencyLevel, Equivalence
© 2015 - 2025 Weber Informatics LLC | Privacy Policy