Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Last active June 18, 2018 18:08
Show Gist options
  • Select an option

  • Save jkyberneees/4eb3f9f18d80f380b15f20d42da77f76 to your computer and use it in GitHub Desktop.

Select an option

Save jkyberneees/4eb3f9f18d80f380b15f20d42da77f76 to your computer and use it in GitHub Desktop.
const lock = hazelcast.getLock('my-distributed-lock')
lock.lock().then(() => {
// the execution of this function will happen once
// at a time across all distributed instances
// ...
console.log('Happy Locking!')
}).finally(() => lock.unlock())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment