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

org.infinispan.lock.configuration.ClusteredLockManagerConfiguration Maven / Gradle / Ivy

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

import java.util.Map;

import org.infinispan.commons.configuration.BuiltBy;
import org.infinispan.commons.configuration.attributes.AttributeDefinition;
import org.infinispan.commons.configuration.attributes.AttributeSet;
import org.infinispan.commons.logging.LogFactory;
import org.infinispan.lock.logging.Log;

/**
 * The {@link org.infinispan.lock.api.ClusteredLockManager} configuration.
 * 

* * @author Katia Aresti, [email protected] * @since 9.4 */ @BuiltBy(ClusteredLockManagerConfigurationBuilder.class) public class ClusteredLockManagerConfiguration { private static final Log log = LogFactory.getLog(ClusteredLockManagerConfiguration.class, Log.class); static final AttributeDefinition RELIABILITY = AttributeDefinition .builder(Attribute.RELIABILITY, Reliability.CONSISTENT) .validator(value -> { if (value == null) { throw log.invalidReliabilityMode(); } }) .immutable().build(); static final AttributeDefinition NUM_OWNERS = AttributeDefinition.builder(Attribute.NUM_OWNERS, -1) .validator(value -> { if (value <= 0 && value != -1) { throw log.invalidNumOwners(value); } }) .immutable().build(); private final AttributeSet attributes; private final Map locks; ClusteredLockManagerConfiguration(AttributeSet attributes, Map locks) { this.attributes = attributes; this.locks = locks; } static AttributeSet attributeDefinitionSet() { return new AttributeSet(ClusteredLockManagerConfiguration.class, NUM_OWNERS, RELIABILITY); } public int numOwners() { return attributes.attribute(NUM_OWNERS).get(); } public Reliability reliability() { return attributes.attribute(RELIABILITY).get(); } AttributeSet attributes() { return attributes; } public Map locks() { return locks; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy