Commit b6d15ee6 authored by Lubomir Bulej's avatar Lubomir Bulej

ThreadLocal: added annotations to the annotation definition

ThreadLocal: updated the annotation and parameter comments
parent ffdda7dd
package ch.usi.dag.disl.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Indicates, that field is used for data passing between several snippets
* The field is translated into thread local variable. The thread local
* variable is by default always initialized the default value of a
* corresponding type. The default value can be inherited from a parent thread
* using optional inheritable annotation parameter.
* <br>
* <br>
* This annotation should be used with fields.
* <br>
* Field should be declared as static, and if not shared between multiple DiSL
* classes, also private.
* Indicates that accesses to the annotated field should be translated into
* accesses to a thread-local variable.
* <p>
* Thread-local variables are typically used for passing data between snippets
* inlined into different methods. By default, the thread-local variable is
* initialized to the default value corresponding to its type. If the
* {@link #inheritable() inheritable} annotation parameter (optional) is set to
* {@code true}, the default value will be inherited from the parent thread.
* <p>
* This annotation can be only used with fields. The fields should be declared
* {@code static}, and if they are not shared between multiple instrumentation
* classes, they should be kept {@code private}.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD })
public @interface ThreadLocal {
// NOTE if you want to change names, you need to change
// ClassParser.TLAnnotationData class in startutil project
// NOTE because of implementation of annotations in java the defaults
// are not retrieved from here but from class mentioned above
/**
* Indicates, weather is the default value inherited from a parent thread.
*
* Default value: false
*/
boolean inheritable() default(false);
// NOTE if you want to change names, you need to change
// ClassParser.TLAnnotationData class in startutil project
// NOTE because of implementation of annotations in Java the defaults,
// are not retrieved from here but from the class mentioned above.
/**
* Determines the default value for a thread-local variable.
* <p>
* If {@code true} , the default value is inherited from the parent thread,
* otherwise the value is initialized to the default value corresponding to
* its type.
*/
boolean inheritable() default (false);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment