@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
public class ReadWriteLockASTTransformation
extends AbstractASTTransformation
Handles generation of code for the @WithReadLock and @WithWriteLock annotation.
This transformation adds an instance of ReentrantReadWriteLock to the class.
Any method annotated with @WithReadLock will obtain a read lock and release it in a finally block.
Any method annotated with @WithWriteLock will obtain a write lock and release it in a finally block.
For more information see WithReadLock and WithWriteLock
| Modifiers | Name | Description |
|---|---|---|
static String |
DEFAULT_INSTANCE_LOCKNAME |
Name of the private final ReentrantReadWriteLock added when an instance method does not name its own lock field. |
static String |
DEFAULT_STATIC_LOCKNAME |
Name of the private static final ReentrantReadWriteLock added when a static method does not name its own lock field. |
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
visit(ASTNode[] nodes, SourceUnit source) |
Name of the private final ReentrantReadWriteLock
added when an instance method does not name its own lock field.
A value equal to this name, ignoring case, also selects the default field.
Name of the private static final ReentrantReadWriteLock added when a static method does not name its own lock field.