org.jboss.ejb
Interface BeanLock

All Known Subinterfaces:
BeanLockExt (src)
All Known Implementing Classes:
BeanLockSupport (src)

public interface BeanLock

BeanLock interface


Method Summary
 void addRef()
          Increment the reference count of this lock.
 void endInvocation(Invocation (src)  mi)
          Callback to the BeanLock to inform it that a method invocation has ended.
 void endTransaction(Transaction (src)  tx)
          Informs the lock that the given transaction has ended.
 java.lang.Object getId()
          Get the bean instance cache id for the bean we are locking for.
 int getRefs()
          Get the current reference count of this lock.
 Transaction (src) getTransaction()
          Get the transaction currently associated with this lock.
 void releaseSync()
          Release exclusive access to this lock instance.
 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 setId(java.lang.Object id)
          Set the bean instance cache id for the bean we are locking for.
 void setTimeout(int timeout)
          Change long we should wait for a lock.
 void setTransaction(Transaction (src)  tx)
          Set the transaction currently associated with this lock.
 void sync()
          Obtain exclusive access to this lock instance.
 void wontSynchronize(Transaction (src)  tx)
          Signifies to the lock that the transaction will not Synchronize (Tx demarcation not seen).
 

Method Detail

getId

public java.lang.Object getId()
Get the bean instance cache id for the bean we are locking for.

Returns:
The cache key for the bean instance we are locking for.

setId

public void setId(java.lang.Object id)
Set the bean instance cache id for the bean we are locking for.

Parameters:
id - The cache key for the bean instance we are locking for.

setTimeout

public void setTimeout(int timeout)
Change long we should wait for a lock.


setContainer

public void setContainer(Container (src)  container)
set the ejb container of this lock.


sync

public void sync()
Obtain exclusive access to this lock instance.


releaseSync

public void releaseSync()
Release exclusive access to this lock instance.


schedule

public void schedule(Invocation (src)  mi)
              throws java.lang.Exception
This method implements the actual logic of the lock. In the case of an EJB lock it must at least implement the serialization of calls

Parameters:
mi - The method invocation that needs a lock.
Throws:
java.lang.Exception

setTransaction

public void setTransaction(Transaction (src)  tx)
Set the transaction currently associated with this lock. The current transaction is associated by the schedule call.

Parameters:
tx - The transaction to associate with this lock.

getTransaction

public Transaction (src)  getTransaction()
Get the transaction currently associated with this lock.

Returns:
The transaction currently associated with this lock, or null if no transaction is currently associated with this lock.

endTransaction

public void endTransaction(Transaction (src)  tx)
Informs the lock that the given transaction has ended.

Parameters:
tx - The transaction that has ended.

wontSynchronize

public void wontSynchronize(Transaction (src)  tx)
Signifies to the lock that the transaction will not Synchronize (Tx demarcation not seen).

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?


endInvocation

public void endInvocation(Invocation (src)  mi)
Callback to the BeanLock to inform it that a method invocation has ended. A common use of this method is to release a method lock.


addRef

public void addRef()
Increment the reference count of this lock.


removeRef

public void removeRef()
Decrement the reference count of this lock.


getRefs

public int getRefs()
Get the current reference count of this lock.

Returns:
The current reference count.