public class ObjWithLock<T> extends Object implements Serializable
Constructor and Description |
---|
ObjWithLock(T obj) |
ObjWithLock(T obj,
ReentrantReadWriteLock lock) |
Modifier and Type | Method and Description |
---|---|
ReentrantReadWriteLock |
getLock() |
T |
getObj() |
ReentrantReadWriteLock.ReadLock |
readLock()
获取读锁
|
void |
setObj(T obj) |
ReentrantReadWriteLock.WriteLock |
writeLock()
获取写锁
|
public ObjWithLock(T obj)
obj
- public ObjWithLock(T obj, ReentrantReadWriteLock lock)
obj
- lock
- public ReentrantReadWriteLock getLock()
public ReentrantReadWriteLock.WriteLock writeLock()
public ReentrantReadWriteLock.ReadLock readLock()
public T getObj()
public void setObj(T obj)
obj
- Copyright © 2018. All rights reserved.