|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.ejb.plugins.lock.BeanLockSupport (src)
org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock
This class is holds threads awaiting the transactional lock to be free in a fair FIFO transactional queue. Non-transactional threads are also put in this wait queue as well. Unlike SimplePessimisticEJBLock which notifies all threads on transaction completion, this class pops the next waiting transaction from the queue and notifies only those threads waiting associated with that transaction. This class should perform better than Simple on high contention loads. Holds all locks for entity beans, not used for stateful.
All BeanLocks have a reference count. When the reference count goes to 0, the lock is released from the id -> lock mapping. As of 04/10/2002, you can now specify in jboss.xml method attributes that define methods as read-only. read-only methods(and read-only beans) will release transactional locks at the end of the invocation. This decreases likelyhood of deadlock and increases performance. FIXME marcf: we should get solid numbers on this locking, bench in multi-thread environments We need someone with serious SUN hardware to run this lock into the ground
Field Summary | |
protected boolean |
deadlockDetection
A flag that disables the deadlock detection check |
protected LockMonitor (src) |
lockMonitor
|
Fields inherited from class org.jboss.ejb.plugins.lock.BeanLockSupport (src) |
container, id, refs, synched, synchedDepth, tx, txTimeout |
Constructor Summary | |
QueuedPessimisticEJBLock()
|
Method Summary | |
protected boolean |
doSchedule(Invocation (src) mi)
doSchedule(Invocation) doSchedule implements a particular policy for scheduling the threads coming in. |
void |
endInvocation(Invocation (src) mi)
releaseMethodLock if we reach the count of zero it means the instance is free from threads (and reentrency) we wake up the next thread in the currentLock |
void |
endTransaction(Transaction (src) transaction)
Informs the lock that the given transaction has ended. |
boolean |
getDeadlockDetection()
|
protected org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.TxLock |
getTxLock(Transaction (src) miTx)
|
protected boolean |
isTxExpired(Transaction (src) miTx)
|
protected void |
nextTransaction()
|
void |
removeRef()
Decrement the reference count of this lock. |
void |
schedule(Invocation (src) mi)
This method implements the actual logic of the lock. |
void |
setContainer(Container (src) container)
set the ejb container of this lock. |
void |
setDeadlockDetection(boolean flag)
|
java.lang.String |
toString()
|
protected boolean |
waitForTx(Transaction (src) miTx,
boolean trace)
Wait until no other transaction is running with this lock. |
void |
wontSynchronize(Transaction (src) trasaction)
Signifies to the lock that the transaction will not Synchronize (Tx demarcation not seen). |
Methods inherited from class org.jboss.ejb.plugins.lock.BeanLockSupport (src) |
addRef, attemptSync, getId, getRefs, getResourceHolder, getTransaction, releaseSync, setId, setTimeout, setTransaction, sync |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected LockMonitor (src) lockMonitor
protected boolean deadlockDetection
Constructor Detail |
public QueuedPessimisticEJBLock()
Method Detail |
public void setContainer(Container (src) container)
BeanLock (src)
setContainer
in interface BeanLock (src)
setContainer
in class BeanLockSupport (src)
public boolean getDeadlockDetection()
public void setDeadlockDetection(boolean flag)
protected org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.TxLock getTxLock(Transaction (src) miTx)
protected boolean isTxExpired(Transaction (src) miTx) throws java.lang.Exception
java.lang.Exception
public void schedule(Invocation (src) mi) throws java.lang.Exception
BeanLock (src)
schedule
in interface BeanLock (src)
schedule
in class BeanLockSupport (src)
java.lang.Exception
protected boolean doSchedule(Invocation (src) mi) throws java.lang.Exception
java.lang.Exception
protected boolean waitForTx(Transaction (src) miTx, boolean trace) throws java.lang.Exception
java.lang.Exception
protected void nextTransaction()
public void endTransaction(Transaction (src) transaction)
BeanLock (src)
endTransaction
in interface BeanLock (src)
endTransaction
in class BeanLockSupport (src)
public void wontSynchronize(Transaction (src) trasaction)
BeanLock (src)
OSH: This method does not seem to be called from anywhere. What is it meant for? To be called on a timeout before the transaction has terminated?
wontSynchronize
in interface BeanLock (src)
wontSynchronize
in class BeanLockSupport (src)
public void endInvocation(Invocation (src) mi)
endInvocation
in interface BeanLock (src)
endInvocation
in class BeanLockSupport (src)
public void removeRef()
BeanLock (src)
removeRef
in interface BeanLock (src)
removeRef
in class BeanLockSupport (src)
public java.lang.String toString()
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |