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

org.infinispan.lock.EmbeddedClusteredLockManagerFactory Maven / Gradle / Ivy

There is a newer version: 15.1.1.Final
Show newest version
package org.infinispan.lock;

import static java.util.Objects.requireNonNull;

import org.infinispan.commons.logging.LogFactory;
import org.infinispan.lock.api.ClusteredLockManager;
import org.infinispan.lock.logging.Log;
import org.infinispan.manager.EmbeddedCacheManager;

/**
 * A {@link ClusteredLockManager} factory for embedded caches.
 *
 * @author Katia Aresti, [email protected]
 * @since 9.2
 */
public final class EmbeddedClusteredLockManagerFactory {

   private static final Log log = LogFactory.getLog(EmbeddedClusteredLockManagerFactory.class, Log.class);

   private EmbeddedClusteredLockManagerFactory() {
   }

   public static ClusteredLockManager from(EmbeddedCacheManager cacheManager) {
      requireNonNull(cacheManager, "EmbeddedCacheManager can't be null.");

      if (!cacheManager.getCacheManagerConfiguration().isClustered()) {
         throw log.requireClustered();
      }
      return SecurityActions.getGlobalComponentRegistry(cacheManager)
            .getComponent(ClusteredLockManager.class);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy