public interface LockService
| Modifier and Type | Method and Description |
|---|---|
Lock |
create(String name)
Acquire a lock by name.
|
Iterable<Lock> |
findAll()
Iterate the existing locks.
|
Lock |
refresh(String name,
String value)
The holder of a lock can refresh it, extending its expiry.
|
void |
release(String name,
String value)
Release a lock before it expires.
|
Lock create(String name) throws LockExistsException
name - the name identifying the lockLockExistsExceptionvoid release(String name, String value) throws LockNotHeldException
name - the name of the lockvalue - the value of the lock (which has to match the value when it was
acquired)LockNotHeldExceptionLock refresh(String name, String value) throws LockNotHeldException
name - the name of the lockvalue - the value of the lock (which has to match the value when it was
acquired)LockNotHeldException - if the value does not match the current value or if
the lock doesn't exist (e.g. if it expired)Copyright © 2018. All rights reserved.