ReetrantLock锁的Maximum lock count exceeded

一直get锁而不释放锁

超过65535次就会抛这个异常

if (w +exclusiveCount(acquires) >MAX_COUNT)

throw new Error("Maximum lock count exceeded");


static final int SHARED_SHIFT = 16;
static final int MAX_COUNT = (1 << SHARED_SHIFT) - 1;


2的16次方也就是65536 

你可能感兴趣的:(ReetrantLock锁的Maximum lock count exceeded)