The thread in DomainSocketWatcher::add() is expected to eventually break the while loop where it waits for the newly added entry being deleted by another thread. However, if this thread is ever interrupted, chances are that it will hold the lock forever so if(!toAdd.contains(entry)) always be false.

The reason here is that, this method catches the InterruptedException and self interrupts during await(). The await() method internally calls AbstractQueuedSynchronizer::await(), which will throw a new InterruptedException if it's interrupted.

Our code in DomainSocketWatcher::add() catches this exception (again) and self interrupt (again). Please note in this process, the associated lock is never released so that the other thread which is supposed to make if(!toAdd.contains(entry)) be true is still pending on the lock.

DomainSocketWatcher::delete() has similar code logic and should suffer from similar problems.