<p>We are using Hazelcast 4 to implement distributed locking across two pods on kuberentes.</p>
<p>We have developed distributed application, two pods of micro service has been created. Both instances are getting auto discovered and forming members.</p>
<p>We are trying to use IMap.lock(key) method to achieve distributed locking across two pods however both pods are acquiring lock at same time, thereby executing the business logic at the concurrently. Also hazelcast management center shows zero locks for the created Imap.</p>
<p>Can you please help on how to achieve synchronization of imap lock(key) so that single pod get the lock for given key at given point of time ?</p>
<p>Code Snippet:-</p>
<pre><code> HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
try{
    IMap map = client.getMap(&quot;customers&quot;);
    map.lock( key );
    //business logic       
  } finally {
              map.unlock( key );
          }
}
</code></pre>

Vasu
<p>Can you create an <a href="https://stackoverflow.com/help/minimal-reproducible-example">mvce</a> and confirm the version of Hazelcast used please.</p>
<p>There are tests for locks <a href="https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/test/java/com/hazelcast/map/MapLockTest.java" rel="nofollow noreferrer">here</a> that you can perhaps use as a way to simplify to determine where the fault lies.</p>
