public interface Lock
| Modifier and Type | Method and Description |
|---|---|
io.vertx.core.Future<Boolean> |
acquireLock(String lock,
String token,
long lockExpiryMs)
Try to acquire a lock.
|
io.vertx.core.Future<Boolean> |
releaseLock(String lock,
String token)
Try to release a lock.
|
io.vertx.core.Future<Boolean> acquireLock(String lock, String token, long lockExpiryMs)
token parameter value must be unique across all clients and all lock requests. The lockExpiryMs
parameter defines the expiry of the lock.
When not manually released, the lock will be released automatically when expired.lock - The name of the lock to acquiretoken - A unique token to define the owner of the locklockExpiryMs - The lock expiry in millisecondsio.vertx.core.Future<Boolean> releaseLock(String lock, String token)
token parameter value is used to verify that only the owner of the lock can release it.
The token parameter value also prevents the original owner of an already expired lock to release a lock
which has been acquired by another client.lock - The name of the lock to releasetoken - A unique token to verify if the owner of the lock tries to release the lockCopyright © 2016–2017. All rights reserved.