public abstract class AbstractDLock extends Object implements IDLock, AutoCloseable
IDLock.DEFAULT_LOCK_DURATION_MS| Constructor and Description |
|---|
AbstractDLock(String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
destroy() |
protected Properties |
getLockProperties()
Get lock's custom properties.
|
protected String |
getLockProperty(String key)
Get lock's custom property.
|
String |
getName()
Get lock's name(space).
|
AbstractDLock |
init() |
LockResult |
lock(String clientId)
Acquire the lock for
clientId with default duration. |
AbstractDLock |
setLockProperties(Properties lockProps)
Lock's custom properties.
|
AbstractDLock |
setName(String name) |
public AbstractDLock(String name)
public String getName()
public AbstractDLock setName(String name)
public AbstractDLock setLockProperties(Properties lockProps)
lockProps - protected Properties getLockProperties()
protected String getLockProperty(String key)
key - public AbstractDLock init()
public void destroy()
public void close()
close in interface AutoCloseablepublic LockResult lock(String clientId)
clientId with default duration.lock in interface IDLockclientId - within a namespace, only one client is allowed to hold lock as
a given timeLockResult.SUCCESSFUL if successful,
LockResult.HOLD_BY_ANOTHER_CLIENT if lock is currently
hold by another clientCopyright © 2018 DDTH. All rights reserved.