com.surelogic
Annotation Type PolicyLocks
@Documented
@Target(value=TYPE)
public @interface PolicyLocks
Container annotation for multiple PolicyLock annotations on a type.
It is a modeling error for a class to have both a PolicyLocks and a
PolicyLock annotation.
Examples
The code below declares two policy locks. The OutsideDoorLock is an
intrinsic lock and the JailLock is a java.util.concurrent.locks.Lock.
@PolicyLocks( {
@PolicyLock("OutsideDoorLock is outsideDoorLock"),
@PolicyLock("JailLock is jailLock")
})
public class Station {
private final Object outsideDoorLock = new Object();
private final Lock jailLock = new ReentrantLock();
void m1() {
synchronized (outsideDoorLock) {
// work with the door
}
jailLock.lock();
try {
// work with the jail
} finally {
jailLock.unlock();
}
}
...
}
Javadoc usage notes:
This annotation is not supported in Javadoc because Javadoc supports multiple
@annotate tags of the same type (see the example below).
Javadoc annotation can be useful for Java 1.4 code which does not include
language support for annotations.
/**
* @annotate PolicyLock("OutsideDoorLock is outsideDoorLock")
* @annotate PolicyLock("JailLock is jailLock")
*/
public class Station {
...
}
- See Also:
PolicyLock
value
public abstract PolicyLock[] value
- The
PolicyLock annotations to apply to the class.
Copyright © 2010 Surelogic, Inc.. All Rights Reserved.