| Method from org.jboss.ejb.plugins.lock.BeanLockSupport Detail: |
public void addRef() {
refs++;
}
|
public boolean attemptSync() {
boolean didSync = false;
synchronized(this)
{
Thread thread = Thread.currentThread();
if(synched == null || synched.equals(thread) == true)
{
synched = thread;
++ synchedDepth;
didSync = true;
}
}
return didSync;
}
A non-blocking method that checks if the calling thread will be able to acquire
the sync lock based on the calling thread. |
abstract public void endInvocation(Invocation mi)
|
abstract public void endTransaction(Transaction tx)
|
public Object getId() {
return id;
}
|
public int getRefs() {
return refs;
}
|
public Object getResourceHolder() {
return tx;
}
|
public Transaction getTransaction() {
return tx;
}
|
public void releaseSync() {
synchronized(this)
{
if (--synchedDepth == 0)
synched = null;
this.notify();
}
}
|
public void removeRef() {
refs--;
}
|
abstract public void schedule(Invocation mi) throws Exception
|
public void setContainer(Container container) {
this.container = container;
}
|
public void setId(Object id) {
this.id = id;
}
|
public void setTimeout(int timeout) {
txTimeout = timeout;
}
|
public void setTransaction(Transaction tx) {
this.tx = tx;
}
The setTransaction associates a transaction with the lock.
The current transaction is associated by the schedule call. |
public void sync() {
synchronized(this)
{
Thread thread = Thread.currentThread();
while(synched != null && synched.equals(thread) == false)
{
try
{
this.wait();
}
catch (InterruptedException ex) { /* ignore */ }
}
synched = thread;
++synchedDepth;
}
}
A method that checks if the calling thread has the lock, and if it
does not blocks until the lock is available. If there is no current owner
of the lock, or the calling thread already owns the lock then the
calling thread will immeadiately acquire the lock. |
abstract public void wontSynchronize(Transaction tx)
|