Migrate ILock with FencedLock

610 views
Skip to first unread message

agusti...@gmail.com

unread,
Apr 28, 2020, 1:54:37 AM4/28/20
to Hazelcast
Hello all,

I would like to migrate existing code to Hazelcast IMDG4.
I notice that com.hazelcast.core.ILock.tryLock(long time, TimeUnit unit, long leaseTime, TimeUnit leaseUnit) is no longer available in FencedLock. I need a capability to auto release the lock after lease time.

Can someone share with me how to achieve it using new API?

Regards,

Agus

Mehmet Dogan

unread,
May 7, 2020, 9:37:53 AM5/7/20
to Hazelcast

Hello,

Lease mechanism in ILock was added because of consistency issues around detecting a lock holder's failure and releasing the lock. New FencedLock implementation inside the CP subsystem doesn't have this issue anymore. FencedLock is built on its own session mechanism which consistently tracks liveness of lock holders. When a member or client holding a lock crashes, splits from the cluster, its acquired locks will be released after some time when its session expires. That's why FencedLock doesn't support leases anymore.

If you still need the lock leases, you can use IMap's locking mechanism which still uses the old locking implementation. 




--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/2689e3f9-d484-437d-abc9-90f34929c147%40googlegroups.com.

This message contains confidential information and is intended only for the individuals named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required, please request a hard-copy version. -Hazelcast
Reply all
Reply to author
Forward
0 new messages