站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > 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
  extended byorg.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

Field Summary
static String TIMEOUT
           
static String TXLOCK
           
 
Constructor Summary
QueuedTxLock()
           
 
Method Summary
 void endInvocation(Transaction thetx)
           
 void endTransaction()
           
 Object getResourceHolder()
           
 Transaction getTransaction()
           
protected  org.jboss.aspects.txlock.QueuedTxLock.TxLock getTxLock(Transaction miTx)
           
protected  boolean isTxExpired(Transaction miTx)
           
 boolean lockNoWait(Transaction transaction)
           
protected  void nextTransaction(boolean trace)
           
 void releaseSync()
           
 void schedule(Transaction miTx, org.jboss.aop.joinpoint.Invocation mi)
          doSchedule(Invocation) doSchedule implements a particular policy for scheduling the threads coming in.
 void setTransaction(Transaction tx)
          The setTransaction associates a transaction with the lock.
 void sync()
           
 String toString()
           
protected  void waitForTx(org.jboss.aop.joinpoint.Invocation mi, Transaction miTx, boolean trace)
          Wait until no other transaction is running with this lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TXLOCK

public static final String TXLOCK
See Also:
Constant Field Values

TIMEOUT

public static final String TIMEOUT
See Also:
Constant Field Values
Constructor Detail

QueuedTxLock

public QueuedTxLock()
Method Detail

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.