Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
DiSL
DiSL
Commits
b6d15ee6
Commit
b6d15ee6
authored
Oct 08, 2013
by
Lubomir Bulej
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ThreadLocal: added annotations to the annotation definition
ThreadLocal: updated the annotation and parameter comments
parent
ffdda7dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
src/ch/usi/dag/disl/annotation/ThreadLocal.java
src/ch/usi/dag/disl/annotation/ThreadLocal.java
+35
-23
No files found.
src/ch/usi/dag/disl/annotation/ThreadLocal.java
View file @
b6d15ee6
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
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment