T R A N S A C T I O N S
Lock
Thread 1
Bean A
Lock
Bean B
Thread 2
In JBoss 3.0 there is a deadlock detection system in place, which will throw a deadlock
exception on one of the threads freeing the other thread to call the other bean. Now the
caller of the interrupted thread receives the exception and can decide to retry the call, to go
over and throw an exception as well.
Example
Derived from the Template the Transaction example mimics a bank where you have banks,
customers, accounts and tellers. The CMP Entity Beans are hidden behind Session Beans,
which contains the business logic, and should only be accessed by them.
Because in this example as well XDoclet is used the specification of the transaction
attributes is very simple:
/**
* The Session bean represents the customer s business interface
* @ejb:transaction type="Required"
*/
public class CustomerSessionBean
extends SessionSupport
{
/**
* @ejb:interface method view type="remote"
* @ejb:transaction type="RequiresNew"
**/
public CustomerData createCustomer(
String pBankId, String pName, float pInitialDeposit
)
throws CreateException, RemoteException
60
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved