Skip to content
Advertisement

Tag: reentrantlock

Is Reentrant Lock a Object level lock or Class level lock?

I see in many tutorials for Reentrant lock, they create a new Reentrant lock and resource is injected, lock and unlock of reentrant lock is called in try/finally block. I don’t understand the connection between this lock and resource which is used in the thread. Below is an example of tutorial on Reentrant lock Resource code Resource being used in

Actual use of lockInterruptibly for a ReentrantLock

What do you actually use for this method lockInterruptibly? I have read the API however it’s not very clear to me. Could anybody express it in other words? Answer The logic is the same as for all interruptible blocking methods: it allows the thread to immediately react to the interrupt signal sent to it from another thread. How this particular

Advertisement