|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.ejb.plugins.lock.BeanLockSupport
org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock
public class 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 |
lockMonitor
|
| Fields inherited from class org.jboss.ejb.plugins.lock.BeanLockSupport |
|---|
container, id, refs, synched, synchedDepth, tx, txTimeout |
| Constructor Summary | |
|---|---|
QueuedPessimisticEJBLock()
|
|
| Method Summary | |
|---|---|
protected boolean |
doSchedule(Invocation mi)
doSchedule(Invocation) doSchedule implements a particular policy for scheduling the threads coming in. |
void |
endInvocation(Invocation 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 transaction)
Informs the lock that the given transaction has ended. |
boolean |
getDeadlockDetection()
|
protected org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.TxLock |
getTxLock(Transaction miTx)
|
protected boolean |
isTxExpired(Transaction miTx)
|
protected void |
nextTransaction()
|
void |
removeRef()
Decrement the reference count of this lock. |
void |
schedule(Invocation mi)
This method implements the actual logic of the lock. |
void |
setContainer(Container container)
set the ejb container of this lock. |
void |
setDeadlockDetection(boolean flag)
|
String |
toString()
|
protected boolean |
waitForTx(Transaction miTx,
boolean trace)
Wait until no other transaction is running with this lock. |
void |
wontSynchronize(Transaction 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 |
|---|
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 lockMonitor
protected boolean deadlockDetection
| Constructor Detail |
|---|
public QueuedPessimisticEJBLock()
| Method Detail |
|---|
public void setContainer(Container container)
BeanLock
setContainer in interface BeanLocksetContainer in class BeanLockSupportpublic boolean getDeadlockDetection()
public void setDeadlockDetection(boolean flag)
protected org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.TxLock getTxLock(Transaction miTx)
protected boolean isTxExpired(Transaction miTx)
throws Exception
Exception
public void schedule(Invocation mi)
throws Exception
BeanLock
schedule in interface BeanLockschedule in class BeanLockSupportmi - The method invocation that needs a lock.
Exception
protected boolean doSchedule(Invocation mi)
throws Exception
Exception
protected boolean waitForTx(Transaction miTx,
boolean trace)
throws Exception
Exceptionprotected void nextTransaction()
public void endTransaction(Transaction transaction)
BeanLock
endTransaction in interface BeanLockendTransaction in class BeanLockSupporttransaction - The transaction that has ended.public void wontSynchronize(Transaction trasaction)
BeanLockOSH: 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 BeanLockwontSynchronize in class BeanLockSupportpublic void endInvocation(Invocation mi)
endInvocation in interface BeanLockendInvocation in class BeanLockSupportpublic void removeRef()
BeanLock
removeRef in interface BeanLockremoveRef in class BeanLockSupportpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||