Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top