...
For example, in the following code, the @Unique("return") annotation documents that the object returned from the constructor is a unique reference.:
| Code Block | ||
|---|---|---|
| ||
@RegionLock("Lock is this protects Instance")
public final class Example {
private int x = 1;
private int y;
@Unique("return")
public Example(int y) {
this.y = y;
}
// ...
}
|
...
Item 70, "Document Thread Safety" | |
Java Concurrency in Practice | |
...