public interface CommunityLockService extends LockService
| Modifier and Type | Method and Description |
|---|---|
LockAcquisition |
upsert(LockKey key,
io.flamingock.internal.util.id.RunnerId owner,
long leaseMillis)
a) If there is an existing lock in the database for the same key and owner
(existingLock.key==newLock.key &&
existingLoc.owner==newLock.owner), then the lock in database is updated/refreshed with the new values. |
extendLock, getLock, releaseLockLockAcquisition upsert(LockKey key, io.flamingock.internal.util.id.RunnerId owner, long leaseMillis) throws LockServiceException
(existingLock.key==newLock.key &&
existingLoc.owner==newLock.owner), then the lock in database is updated/refreshed with the new values. The most
common scenario is to extend the lock's expiry date.
b) If there is an existing lock in the database for the same key and different owner, but expired (existingLock.key==newLock.key &&
existingLock.owner!=newLock.owner && now > expiredAt), the lock is replaced with the newLock, so the owner of the lock for
that key is newLock.owner
c) If scenario b, but lock is not expired yet, should throw an LockPersistenceException.
d) If there isn't any lock with key=newLock.key, newLock is inserted.
key - Specially important in cloud execution as it represents a serviceowner - It references the running instanceleaseMillis - How long(in millis) the lock will be acquired for.LockServiceException - if there is a lock in database with same key, but is expired and belong to
another owner or cannot insert/update the lock for any other reason