transient final ReentrantLock lock = new ReentrantLock();
.....................
.....................
private static final Unsafe unsafe = Unsafe.getUnsafe();
private static final long lockOffset;
static {
try {
lockOffset = unsafe.objectFieldOffset
(CopyOnWriteArrayList.class.getDeclaredField("lock"));
} catch (Exception ex) { throw new Error(ex); }
}
private void resetLock() {
unsafe.putObjectVolatile(this, lockOffset, new ReentrantLock());
}
[list]
[*] 在反序列化之后如何重设锁的呢?
[/list]