|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ILockValue
Represents a lock value.
Method Summary | |
---|---|
ILockValue |
clone(Map<Object,Object> cloneMap)
Override to specialize return type |
int |
getLockCounter()
Gets the lock counter of the owner of this lock. |
IntSet |
getNotification()
Gets the notification set of this lock value. |
int |
getOwner()
Gets the thread id who hold this lock. |
IntSet |
getWaiting()
Gets the wait set of this lock value. |
byte[][] |
linearize(int bitsPerNonPrimitiveValue,
ObjectIntTable nonPrimitiveValueIdMap,
int bitsPerThreadId,
IntIntTable threadOrderMap)
Linearizes this lock value. |
void |
opLock(int threadId)
Does a lock operation on this lock value. |
void |
opNotify(int threadId,
int nextThreadId)
Does a notify operation on this lock value. |
void |
opNotifyAll(int threadId)
Does a notify all operation on this lock value. |
void |
opUnlock(int threadId)
Does an unlock operation on this lock. |
void |
opUnwait(int threadId,
int i)
Does an unwait operation on this lock value. |
int |
opWait(int threadId)
Does a wait operation on this lock value. |
void |
setLockCounter(int lockCounter)
Sets the lock counter of the owner of this lock. |
void |
setOwner(int threadId)
Sets the thread id who holds this lock. |
boolean |
testHasLock(int threadId)
Tests whether a particular thread holds this lock value. |
boolean |
testLockAvailable(int threadId)
Tests whether this lock value is available to do operation on by a particular thread. |
boolean |
testWasNotified(int threadId)
Tests whether a particular thread was notified in this lock value. |
void |
undoOp(LockOp lockOp,
int owner,
int lockCounter,
int[] notification,
int[] waiting,
int notifiedThreadId)
Undo a lock op. |
Methods inherited from interface edu.ksu.cis.projects.bogor.module.value.INonPrimitiveValue |
---|
getReferenceId |
Methods inherited from interface edu.ksu.cis.projects.bogor.module.value.IValue |
---|
equals, getType, getTypeId, hashCode, toString, validate |
Methods inherited from interface edu.ksu.cis.projects.bogor.util.Disposable |
---|
dispose |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Method Detail |
---|
void setLockCounter(int lockCounter)
lockCounter
- The lock counter if this lock is held.int getLockCounter()
IntSet getNotification()
void setOwner(int threadId)
threadId
- The thread id who holds this lock.int getOwner()
IntSet getWaiting()
byte[][] linearize(int bitsPerNonPrimitiveValue, ObjectIntTable nonPrimitiveValueIdMap, int bitsPerThreadId, IntIntTable threadOrderMap)
bitsPerNonPrimitiveValue
- The number of bits used to encode a non-primitive value.nonPrimitiveValueIdMap
- A mapping of non-primitive values to their unique id. Must be
non-null.bitsPerThreadId
- The number of bits used to encode a thread descriptor.threadOrderMap
- A mapping of thread descriptors to their order number. Must be
non-null.
void opLock(int threadId)
threadId
- The thread id that wants to lock this lock value.
BadMonitorBogorException
- When the lock value is held by other thread.void opNotify(int threadId, int nextThreadId)
threadId
- The thread id that wants to notify this lock value. This
thread id must be contained in this lock value's wait set.nextThreadId
- If not EPSILON
, then this thread id is
notified (put to this lock value's notification set).
BadMonitorBogorException
- When the lock value is held by other thread or the lock value
is free.void opNotifyAll(int threadId)
threadId
- The thread id that wants to notify this lock value.
BadMonitorBogorException
- When the lock value is held by other thread or the lock value
is free.void opUnlock(int threadId)
threadId
- The thread id that wants to unlock this lock value.
BadMonitorBogorException
- When the lock value is held by other thread or the lock value
is free.void opUnwait(int threadId, int i)
i
.
The thread is then removed from the notification set.
threadId
- The thread id that wants to unwait this lock value.i
- The lock counter of this lock value for the given thread. Must
be at least one.
BadMonitorBogorException
- When the lock value is not free, or the given thread id is not
in this lock value's notification set.int opWait(int threadId)
threadId
- The thread id that wants to wait this lock value.
BadMonitorBogorException
- When the lock value is free, or held by another thread.boolean testHasLock(int threadId)
threadId
- The thread id that wants to test whether it holds this lock
value.
boolean testLockAvailable(int threadId)
threadId
- The thread id that wants to test this lock value's
availability.
boolean testWasNotified(int threadId)
threadId
- The thread id that wants to test whether it has been notified
in this lock value.
void undoOp(LockOp lockOp, int owner, int lockCounter, int[] notification, int[] waiting, int notifiedThreadId)
lockOp
- The lock op. Must be a valid.owner
- The owner of this lock value.lockCounter
- The lock counter. Must be equal or greater than 0.notification
- The notification set. Must be non-null.waiting
- The waiting set. Must be non-null.ILockValue clone(Map<Object,Object> cloneMap)
clone
in interface INonPrimitiveValue
clone
in interface IValue
cloneMap
- Original values (IValue
) to their clones (
IValue
) mapping. The clone map to solve
circular references in values. If this value is a key in the
map, then this method returns the value of the key in the map.
Must be non-null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |