|
NetKernel APIs |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ten60.netkernel.util.AsynchLock
Atomic lock request and aquire. unlock might return a released previously unaquired lock request if one
exists.
not thread safe- external synchronization must be provided.
Constructor Summary | |
AsynchLock(int aKeyCount,
int aContentionCount)
Creates a new instance of AsynchLock |
Method Summary | |
Iterator |
getPendingReferences()
returns an iterator over all pending lock request references |
boolean |
lock(Object aKey,
Object aReference)
Attempt to gain an exclusive lock on the given key, takes a reference object to hang onto if the lock fails to be granted that is then returned on an unlock when the lock has been granted |
Object |
unlock(Object aKey)
releases a lock on the given key, this method must only be called after a lock has been granted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AsynchLock(int aKeyCount, int aContentionCount)
aKeyCount
- size to make lock mapaContentionCount
- expected lock contention count- so as to allocate a list long enough to hold them without needing to expandMethod Detail |
public boolean lock(Object aKey, Object aReference)
aKey
- the key object that we want to gain an exclusive lock onaReference
- a reference object for the request to lock
public Object unlock(Object aKey)
aKey
- the key object that we are releasing the exclusive lock on
public Iterator getPendingReferences()
|
NetKernel APIs |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |