@ThreadSafe public final class DbLockKeeper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DbLockKeeper.LockHandle
Handle for a specific lock.
|
| Modifier and Type | Method and Description |
|---|---|
static DbLockKeeper |
getInstance() |
static void |
init(DataSource ds)
Initializes the DbLockKeeper.
|
DbLockKeeper.LockHandle |
lock(String lockName)
Method should be used to create a lock.
|
DbLockKeeper.LockHandle |
lockNowait(String lockName)
Get a lock, but do not wait for it- if the lock is taken the code
returns immediately, returning a null lock handle.
|
public static DbLockKeeper getInstance()
public static void init(DataSource ds)
ds - the datasource used to create the connections.public DbLockKeeper.LockHandle lock(String lockName) throws Exception
lockName - the name of the lockException@Nullable public DbLockKeeper.LockHandle lockNowait(String lockName) throws Exception
lockName - ExceptionCopyright © 2017 etc.to. All rights reserved.