سؤال

For the

Hazelcast.getLock(Object key)

method, what is the expected/acceptable key object? For instance, is it okay to use a String to refer to this lock from different nodes in the cluster? Or does it have to be a distributed object of some sort?

To be completely precise, does the call Hazelcast.getLock("myLock"), when called from two different cluster members, refer to the same distributed lock?

هل كانت مفيدة؟

المحلول

To be Serializable is the only requirement. Keys like String, integer or long are preferred because of their simplicity.

Yes, Hazelcast.getLock("myLock") will refer to the same lock in any member of the cluster.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top