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

org.multiverse.annotations.FieldGranularity Maven / Gradle / Ivy

Go to download

Contains the core interfaces/classes of the Multiverse project. So no STM implementations

There is a newer version: 0.7.0
Show newest version
package org.multiverse.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation that can be placed above a field to indicate that the STM should use a field level granularity
 * instead of object level granularity. If you have a transactional object with 2 mutable fields, 2
 * transactions could conflict even if they are writing to a different one. This reduce this 'unneeded'
 * failure, this annotation can be placed on fields.
 * 

* Under water these fields are transformed to transactional references or transactional refs. *

*

 *  &at;TransactionalObject
 *  class Person{
 *      &at;FieldGranularity
 *      private String name;
 *      &at;FieldGranularity
 *      private int age;
 *  }
 * 
*

* This is transformed to: *

*

 * &at;TransactionalObject
 * class Person{
 *     private final Ref<String> name = new ...
 *     private final IntRef age = new ...
 * }
 * 
* * @author Peter Veentjer. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface FieldGranularity { }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy