I have a reentrant lock which I am wrapping in a customized class for my own needs. However due to the nature of the application a thread holding the lock to the reentrant lock gets stuck (external failures) and fails to release the reentrant lock.
I am wondering if there is a method to explicitly unlock the reentrant lock? I know the API for Reentrant lock does not have such a method – however I was thinking of introducing a timer task which will unlock the Reentrant lock after a set period of time OR kill the thread which holds the reentrant lock.
Any other suggestions in trying to force unlock my reentrant lock? My solutions are pretty thus I ask.
Instead of unlocking externally, I would execute the blocking code in a separate thread and have it timeout
something like this