当前页面:
在线文档首页 >
JBoss 4.0.1 sp1 aspects API Documentation 英文版文档
QueuedTxLock (JBoss Aspects API) - JBoss 4.0.1 sp1 aspects API Documentation 英文版文档
org.jboss.aspects.txlock
Class QueuedTxLock
java.lang.Object
org.jboss.aspects.txlock.QueuedTxLock
- All Implemented Interfaces:
- org.jboss.util.deadlock.Resource
- public class QueuedTxLock
- extends Object
- implements org.jboss.util.deadlock.Resource
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. This class pops the next waiting transaction from the queue
and notifies only those threads waiting associated with that transaction.
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
- Version:
- $Revision: 1.1 $
- Author:
- Marc Fleury, Bill Burke
TXLOCK
public static final String TXLOCK
- See Also:
- Constant Field Values
TIMEOUT
public static final String TIMEOUT
- See Also:
- Constant Field Values
QueuedTxLock
public QueuedTxLock()
getResourceHolder
public Object getResourceHolder()
- Specified by:
getResourceHolder
in interface org.jboss.util.deadlock.Resource
sync
public void sync()
throws InterruptedException
- Throws:
InterruptedException
releaseSync
public void releaseSync()
setTransaction
public void setTransaction(Transaction tx)
- The setTransaction associates a transaction with the lock.
The current transaction is associated by the schedule call.
getTransaction
public Transaction getTransaction()
getTxLock
protected org.jboss.aspects.txlock.QueuedTxLock.TxLock getTxLock(Transaction miTx)
isTxExpired
protected boolean isTxExpired(Transaction miTx)
throws Exception
- Throws:
Exception
lockNoWait
public boolean lockNoWait(Transaction transaction)
throws Exception
- Throws:
Exception
schedule
public void schedule(Transaction miTx,
org.jboss.aop.joinpoint.Invocation mi)
throws Exception
- doSchedule(Invocation)
doSchedule implements a particular policy for scheduling the threads coming in.
There is always the spec required "serialization" but we can add custom scheduling in here
Synchronizing on lock: a failure to get scheduled must result in a wait() call and a
release of the lock. Schedulation must return with lock.
- Throws:
Exception
waitForTx
protected void waitForTx(org.jboss.aop.joinpoint.Invocation mi,
Transaction miTx,
boolean trace)
throws Exception
- Wait until no other transaction is running with this lock.
- Returns:
- Returns true if this thread was scheduled in txWaitQueue
- Throws:
Exception
nextTransaction
protected void nextTransaction(boolean trace)
endTransaction
public void endTransaction()
endInvocation
public void endInvocation(Transaction thetx)
toString
public String toString()
Copyright © 2002 JBoss Group, LLC. All Rights Reserved.