On Wed, 2002-07-17 at 00:43, Maris Orbidans wrote:
> 
> 
> Start a new transaction with someMethod(accountNumber1,amount) method. I think then 
>the SFSB will be removable because it will not be participating in any transaction.

This is true, but doesn't actually help what I am trying to do.  I need
to update a non-transactional datasource, and the best way to do this
seems to be to use SessionSynchronization, (which can ONLY be used on
SFSB's). The update needs to be part of the outer transaction. This
seems to preclude the use of ANY SLSB's anywhere between the original
client call and the SFSB doing the SessionSynchronization.  This seems
like a nasty, dangerous and undocumented restriction.

> 
> >This means, for example, that the Container may delegate the
> > requests from the same client within the same transaction to 
> > different 
> > instances, and that the Container may interleave requests 
> > from multiple 
> > transactions to the same instance
> 
> I am not sure that it means that instances of SLSB are reentrant.  (spec. 7-11-8)
> 
> 
> Maris
> 
> 
> > -----Original Message-----
> > From: Craig O'Shannessy [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 16, 2002 12:15 PM
> > To: jboss-user
> > Subject: [JBoss-user] stateless session beans cannot call 
> > stateful session beans!!?
> > 
> > 
> > Hi,
> > 
> > I wonder if someone could clear up a problem for me.  It seems that a 
> > Stateless session bean cannot really use a Stateful session bean for
> > two reasons.
> > 
> > 1. The stateless bean cannot call remove on the stateful, 
> > therefore can't
> >    clean it up (see code below)
> > 
> > 2. If the stateless bean holds onto a reference to a stateful 
> > bean to get
> >    around creating one on each call and avoid problem 1., 
> > another problem
> >    occurs.  The Stateless bean can be shared between 
> > concurrent transactions
> >    (see quote from spec below), therefore the stateful beans 
> > transactional
> >    scope is indeterminate (cause nasty blocking or even overlapping 
> >    transactions?)
> > 
> > One reason you might want to use a Stateful bean from a 
> > Stateless is to
> > do SessionSyncronization on a non transactional datasouce for example.
> > 
> > --------- Code example for problem 1. 
> > --------------------------------------
> > /**
> >  * For readability, this example uses xdoclet code, if you 
> > don't use it,
> >  * you might want to check it out!
> >  */
> > class StatelessBean extends SessionBean
> > {
> >     /**
> >      * @ejb:interface-method
> >      */
> >     public void transferMoney(long account1,long 
> > account2,double amount)
> >     {
> >         StatefulEJBLocal stateful = 
> > StatefulEJBUtil.getLocalhome().create();
> >         stateful.someMethod(accountNumber1,amount);
> >         // stateful.remove();  <-- Can't do this, RemoveException 
> >                                //  (7.5.7 p79 ejb2 spec)
> >     }
> > }
> > --------------------------------------------------------------
> > ----------------
> > Quote from Section 7.8, p87 of ejb2 spec
> > 
> > Because all instances of a stateless session bean are equivalent, the 
> > container can choose to delegate a client-invoked method to 
> > any available 
> > instance. This means, for example, that the Container may delegate the
> > requests from the same client within the same transaction to 
> > different 
> > instances, and that the Container may interleave requests 
> > from multiple 
> > transactions to the same instance.
> > 
> > 
> > 
> > -------------------------------------------------------
> > This sf.net email is sponsored by: Jabber - The world's 
> > fastest growing 
> > real-time communications platform! Don't just IM. Build it in! 
> > http://www.jabber.com/osdn/xim
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
> > 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by: Jabber - The world's fastest growing 
> real-time communications platform! Don't just IM. Build it in! 
> http://www.jabber.com/osdn/xim
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user





-------------------------------------------------------
This sf.net email is sponsored by: Jabber - The world's fastest growing 
real-time communications platform! Don't just IM. Build it in! 
http://www.jabber.com/osdn/xim
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to