|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.txn.LockInfo
com.sleepycat.je.txn.ThinLockImpl
public class ThinLockImpl
Implements a lightweight Lock with no waiters and only a single Owner. If, during an operation (lock) more than one owner or waiter is required, then this will mutate to a LockImpl, perform the requested operation, and return the new LockImpl to the caller. public for Sizeof.
Field Summary |
---|
Fields inherited from class com.sleepycat.je.txn.LockInfo |
---|
locker, lockType |
Constructor Summary | |
---|---|
ThinLockImpl()
Create a Lock. |
Method Summary | |
---|---|
void |
demote(Locker locker)
Downgrade a write lock to a read lock. |
void |
flushWaiter(Locker locker,
MemoryBudget mb,
int lockTableIndex)
Remove this locker from the waiter list. |
LockType |
getOwnedLockType(Locker locker)
Returns the LockType if the given locker owns this lock, or null if the lock is not owned. |
Set<LockInfo> |
getOwnersClone()
Get a new Set of the owners. |
List<LockInfo> |
getWaitersListClone()
Get a list of waiters for debugging and error messages. |
Locker |
getWriteOwnerLocker()
Return the locker that has a write ownership on this lock. |
boolean |
isOwnedWriteLock(Locker locker)
Return true if locker is an owner of this Lock and this is a write lock. |
boolean |
isOwner(Locker locker,
LockType lockType)
Return true if locker is an owner of this Lock for lockType, false otherwise. |
boolean |
isThin()
|
boolean |
isWaiter(Locker locker)
Return true if locker is a waiter on this Lock. |
LockAttemptResult |
lock(LockType requestType,
Locker locker,
boolean nonBlockingRequest,
boolean jumpAheadOfWaiters,
MemoryBudget mb,
int lockTableIndex)
Attempts to acquire the lock and returns the LockGrantType. |
int |
nOwners()
|
int |
nWaiters()
|
Set<Locker> |
release(Locker locker,
MemoryBudget mb,
int lockTableIndex)
Releases a lock and moves the next waiter(s) to the owners. |
void |
stealLock(Locker locker,
MemoryBudget mb,
int lockTableIndex)
Removes all owners except for the given owner, and sets the Preempted property on the removed owners. |
String |
toString()
Debug dumper. |
Methods inherited from class com.sleepycat.je.txn.LockInfo |
---|
clone, dump, getDeadlockStackTrace, getLocker, getLockType, setDeadlockStackTrace, setLocker, setLockType |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ThinLockImpl()
Method Detail |
---|
public List<LockInfo> getWaitersListClone()
Lock
getWaitersListClone
in interface Lock
public void flushWaiter(Locker locker, MemoryBudget mb, int lockTableIndex)
Lock
flushWaiter
in interface Lock
public Set<LockInfo> getOwnersClone()
Lock
getOwnersClone
in interface Lock
public boolean isOwner(Locker locker, LockType lockType)
Lock
isOwner
in interface Lock
public boolean isOwnedWriteLock(Locker locker)
Lock
isOwnedWriteLock
in interface Lock
public LockType getOwnedLockType(Locker locker)
Lock
getOwnedLockType
in interface Lock
public boolean isWaiter(Locker locker)
Lock
isWaiter
in interface Lock
public int nWaiters()
nWaiters
in interface Lock
public int nOwners()
nOwners
in interface Lock
public LockAttemptResult lock(LockType requestType, Locker locker, boolean nonBlockingRequest, boolean jumpAheadOfWaiters, MemoryBudget mb, int lockTableIndex) throws DatabaseException
Lock
lock
in interface Lock
DatabaseException
public Set<Locker> release(Locker locker, MemoryBudget mb, int lockTableIndex)
Lock
release
in interface Lock
public void stealLock(Locker locker, MemoryBudget mb, int lockTableIndex)
Lock
stealLock
in interface Lock
public void demote(Locker locker)
Lock
demote
in interface Lock
public Locker getWriteOwnerLocker()
Lock
getWriteOwnerLocker
in interface Lock
public boolean isThin()
isThin
in interface Lock
public String toString()
Lock
toString
in interface Lock
toString
in class LockInfo
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |