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

org.infinispan.configuration.cache.VersioningConfiguration Maven / Gradle / Ivy

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

import org.infinispan.commons.configuration.attributes.Attribute;
import org.infinispan.commons.configuration.attributes.AttributeDefinition;
import org.infinispan.commons.configuration.attributes.AttributeSet;

/**
 * This configuration element controls whether entries are versioned. Versioning is necessary, for example, when
 * using optimistic transactions in a clustered environment, to be able to perform write-skew checks.
 * @deprecated since 9.0. Infinispan automatically enable versioning when needed.
 */
@Deprecated
public class VersioningConfiguration {
   public static final AttributeDefinition ENABLED = AttributeDefinition.builder("enabled", true).immutable().autoPersist(false).build();
   public static final AttributeDefinition SCHEME = AttributeDefinition.builder("scheme", VersioningScheme.SIMPLE).immutable().build();

   static AttributeSet attributeDefinitionSet() {
      return new AttributeSet(VersioningConfiguration.class, ENABLED, SCHEME);
   }

   private final Attribute enabled;
   private final Attribute scheme;
   private final AttributeSet attributes;

   VersioningConfiguration(AttributeSet attributes) {
      this.attributes = attributes.checkProtection();
      enabled = attributes.attribute(ENABLED);
      scheme = attributes.attribute(SCHEME);
   }

   public boolean enabled() {
      return enabled.get();
   }

   public VersioningScheme scheme() {
      return scheme.get();
   }

   @Override
   public boolean equals(Object o) {
      VersioningConfiguration other = (VersioningConfiguration) o;
      return attributes.equals(other.attributes);
   }

   @Override
   public int hashCode() {
      return attributes.hashCode();
   }

   @Override
   public String toString() {
      return attributes.toString();
   }

   public AttributeSet attributes() {
      return attributes;
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy