ReaderPreferenceReadWriteLock, WriterPreferenceReadWriteLockpublic interface ReadWriteLock
Standard usage:
class X {
ReadWriteLock rw;
// ...
public void read() throws InterruptedException {
rw.readLock().acquire();
try {
// ... do the read
}
finally {
rw.readlock().release()
}
}
public void write() throws InterruptedException {
rw.writeLock().acquire();
try {
// ... do the write
}
finally {
rw.writelock().release()
}
}
}
[ Introduction to this package. ]| Modifier and Type | Method | Description |
|---|---|---|
Sync |
readLock() |
get the readLock
|
Sync |
writeLock() |
get the writeLock
|