W R I T E A N D D E P L O Y J 2 E E A P P L I C A T I O N S
Stateful Session Beans
Stateful Session Beans (SFSB for short) is either in a ready pool (unused) or assigned to a
particular client. Thus a client call to a SFSB will always reach the same SFSB with the
exceptions when a SFSB times out or when the client removes and creates a new SFSB.
In the transaction example the Teller Session Bean is s SLSB meaning that when
information like to which bank the teller belongs has to be delivered by the client on every
call. With a SFSB it can contain these informations and free the client from doing so.
The disadvantage is that for every client using this Session Bean there is a SFSB copy
reserved. So when you have 10,000 concurrent users could have 10,000 instances of this
SFSB even when they are rarely used.
Another feature of the SFSB is that a user transaction (BMT) started in a method does not
have to be finished within this method call. This allows you to have a method creating an
order and then several method calls to add items to this order. At the end the client places
the order and thus finishes the transaction. Important to note that the client has to know
what starts and what ends a transaction because a transaction cannot be finished when not
started in the first place and when a transaction is never finished it will be rolled back by
the server anyway and therefore everything is lost.
Message Driven Beans
Message Driven Beans (or MDB for short) are like SLSB but with the exception that they do
not have a Home interface and therefore cannot be called by a client directly. Instead they
are listening for JMS messages from a particular Destination. Thus any client able to send a
message to the JMS provider will invoke the onMessage() on the MDB. This client must
not be a Java (JMS) client but it could be a mainframe computer sending a message.
To write a MDB it is necessary to add the MessageListener interface to the implements list
even this looks superfluous. The idea behind is to be able to add other interfaces than the
MessageListener in the future. The Template project already contains an example of a MDB
that listens on the queue/testQueue queue.
Unfortunately XDoclet 1.1.2 does not support some advanced features of JBoss MDB
settings. The DTD description for MDBs looks like:
ejb name , destination jndi name , mdb user? , mdb passwd? , mdb client id? ,
mdb subscription id? , configuration name? , security proxy? , ejb ref* ,
resource ref* , resource env ref*
)>
The mdb user and mdb passwd is use to create a connection with this user name
password pair, the mdb client id allows you to specify a certain client id that is associated
49
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