twitter-archive / commons

Twitter common libraries for python and the JVM (deprecated)
http://twitter.github.com/commons
Other
2.1k stars 565 forks source link

DistributedLock Issues : Interrupt thread after get lock, CountDownLatch is not reset while lock at the next time #479

Open 1316151417 opened 5 years ago

1316151417 commented 5 years ago

Interrupt thread after get lock, CountDownLatch is not reset while lock at the next time

reset CountDownLatch at method prepare(), code :
private synchronized void prepare() { ...... syncPoint = new CountDownLatch(1); }


Interrupt thread after get lock, the field currentNode is null, cleanup will throw NullPointException

Allow it to be null, code :
private void cleanup() { if(currentNode != null) { //delete currentNode.... } ...... }