How to show all current locks in hazelcast

后端 未结 2 1753
暗喜
暗喜 2021-01-23 01:35

I am a newbie for Hazelcast. I would like to know how can I list current lock in Hazelcast console?

For ex. assume that i open three console and i have taken 3 lock as f

2条回答
  •  臣服心动
    2021-01-23 01:56

    Console is just a test app to simulate basic functionalities of hazelcast.

    To see your lock instances following code will help you.

    HazelcastInstance hzInstance = Hazelcast.newHazelcastInstance(null);
    Collection instances = hzInstance.getInstances();
    Set locks = new HashSet();
    for (Instance inst : instances) {
        if(inst.getInstanceType().equals(Instance.InstanceType.LOCK))
        locks.add(inst);
    }
    

提交回复
热议问题