[docs] Locked example needed its usage examples moved

This commit is contained in:
Reinier Zwitserloot committed 2024-03-20 01:13:12 +01:00
1 parent 0023c598c7
commit d2a18ebf75
2 files changed

No files matched your search

@@ -1,32 +0,0 @@
public class LockedExample {
private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final Lock baseLock = new ReentrantLock();
private int value = 0;
public int getValue() {
this.lock.readLock().lock();
try {
return value;
} finally {
this.lock.readLock().unlock();
}
}
public void setValue(int newValue) {
this.lock.writeLock().lock();
try {
value = newValue;
} finally {
this.lock.writeLock().unlock();
}
}
public void foo() {
this.baseLock.lock();
try {
System.out.println("bar");
} finally {
this.baseLock.unlock();
}
}
}
@@ -1,20 +0,0 @@
import lombok.Locked;
public class LockedExample {
private int value = 0;
@Locked.Read
public int getValue() {
return value;
}
@Locked.Write
public void setValue(int newValue) {
value = newValue;
}
@Locked("baseLock")
public void foo() {
System.out.println("bar");
}
}