Modifier and Type | Class and Description |
---|---|
private class |
NonstopSync.ExplicitLockingClusterOperationImpl
For try lock and unlock non stop cases
|
private static class |
NonstopSync.LockOperationType
enum for try lock and unlock opertation types
|
private static class |
NonstopSync.OperationState
enum for lock state diagram
|
Modifier and Type | Field and Description |
---|---|
private ExplicitLockingContextThreadLocal |
explicitLockingContextThreadLocal |
private java.lang.Object |
key |
private NonstopActiveDelegateHolder |
nonstopActiveDelegateHolder |
private NonstopConfiguration |
nonstopConfiguration |
private NonstopStore |
nonstopStore |
ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR
Constructor and Description |
---|
NonstopSync(NonstopStore nonstopStore,
NonstopActiveDelegateHolder nonstopActiveDelegateHolder,
ExplicitLockingContextThreadLocal explicitLockingContextThreadLocal,
java.lang.Object key,
NonstopConfiguration nonstopConfiguration)
Constructor accepting the
NonstopStore and the actual Sync |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getKey()
Return the key associated with this
Sync |
boolean |
isHeldByCurrentThread(LockType type)
Returns true is this is lock is held at given level by the current thread.
|
void |
lock(LockType type)
Acquire lock of LockType.READ or WRITE
|
boolean |
tryLock(LockType type,
long msec)
Tries to acquire a LockType.READ or WRITE for a certain period
|
void |
unlock(LockType type)
Releases the lock held by the current Thread.
|
private final NonstopStore nonstopStore
private final ExplicitLockingContextThreadLocal explicitLockingContextThreadLocal
private final java.lang.Object key
private final NonstopActiveDelegateHolder nonstopActiveDelegateHolder
private final NonstopConfiguration nonstopConfiguration
public NonstopSync(NonstopStore nonstopStore, NonstopActiveDelegateHolder nonstopActiveDelegateHolder, ExplicitLockingContextThreadLocal explicitLockingContextThreadLocal, java.lang.Object key, NonstopConfiguration nonstopConfiguration)
NonstopStore
and the actual Sync
nonstopStore
- nonstopActiveDelegateHolder
- key
- key2
- public java.lang.Object getKey()
Sync
Sync
public boolean isHeldByCurrentThread(LockType type)
isHeldByCurrentThread
in interface Sync
type
- the lock type to testpublic void lock(LockType type)
public boolean tryLock(LockType type, long msec) throws java.lang.InterruptedException