I have a LockManager that manages the locks of several threads. Sometimes the threads are bad boys, and I have to kill them and ask the LockManager to release all their locks. However, since I use ReentrantLock in java this is impossible, I can not unlock a lock owned by another thread.
I am forced to use Locks (cannot use semaphores, it is point of the homework). Is there any Java Lock implementation that allows me to unlock locks owned by other threads?
So far the options I considered are:
- re-implementing ReentrantLock in a way that allows me to do this
- Make some sort of mapping between Semaphores and ReentrantLocks
Extra Sources you may find useful: