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

org.infinispan.factories.LockContainerFactory Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.factories;

import org.infinispan.factories.annotations.DefaultFactoryFor;
import org.infinispan.util.concurrent.locks.impl.LockContainer;
import org.infinispan.util.concurrent.locks.impl.PerKeyLockContainer;
import org.infinispan.util.concurrent.locks.impl.StripedLockContainer;

/**
 * Factory class that creates instances of {@link LockContainer}.
 *
 * @author Pedro Ruivo
 * @since 7.0
 */
@DefaultFactoryFor(classes = LockContainer.class)
public class LockContainerFactory extends AbstractNamedCacheComponentFactory implements AutoInstantiableFactory {

   @SuppressWarnings("unchecked")
   @Override
   public  T construct(Class componentType) {
      return (T) (configuration.locking().useLockStriping() ?
                        new StripedLockContainer(configuration.locking().concurrencyLevel()) :
                        new PerKeyLockContainer());
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy