Re: [JBoss-dev] Problems using UserTransaction
You can't use your own threads in ejbs. It's against spec and doesn't work with transactions, as you have discovered. david jencks On 2002.06.03 13:37:54 -0400 Patrícia Soares Canela wrote: > Hi there! > > I have this EJB, bean managed wich controls client's request and invokes > other beans. > I'm lauching threads to invilke these other beans. > > Supose that I have this transaction that needs to resort to three > diferent > beans; supose that the second bean fails and transaction must be rolled > back. > > Well, this isn´t happening! In fact, transaction is rolled back, but all > previous data has been persisted in database. > > Is it because of using threads or is it something in transactions that > I´m > doing wrong. > > > Thank you for your atention > > Patrícia > > > > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Problems using UserTransaction
OK! So, do you know any way to implement cuncurrent processing with EJBs. If I cannot use threads, how can I perform the execution of several services in the same transaction? -Original Message- From: David Jencks [mailto:[EMAIL PROTECTED]] Sent: segunda-feira, 3 de Junho de 2002 19:04 To: [EMAIL PROTECTED] Subject: Re: [JBoss-dev] Problems using UserTransaction You can't use your own threads in ejbs. It's against spec and doesn't work with transactions, as you have discovered. david jencks On 2002.06.03 13:37:54 -0400 Patrícia Soares Canela wrote: > Hi there! > > I have this EJB, bean managed wich controls client's request and invokes > other beans. > I'm lauching threads to invilke these other beans. > > Supose that I have this transaction that needs to resort to three > diferent > beans; supose that the second bean fails and transaction must be rolled > back. > > Well, this isn´t happening! In fact, transaction is rolled back, but all > previous data has been persisted in database. > > Is it because of using threads or is it something in transactions that > I´m > doing wrong. > > > Thank you for your atention > > Patrícia > > > > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Problems using UserTransaction
This may or may not workgive it a try and tell me if it works. Use the TransactionManager directly. void someEJBMethod() { InitialContext ctx = new InitialContext(); TransactionManager tm = (TransactionManager)ctx.lookup("java:/TransactionManager"); Transaction tx = tm.getTransaction(); //... //... Create your threads and pass in the tx as a parameter } // Thread code void run() { tm.resume(this.tx); //... do your stuff } Am I making sense? Regards, Bill Burke JBossGroup --- Don't forget to vote for JBoss for the JDJ Awards! http://www.sys-con.com/java/readerschoice2002/nominationform.cfm > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Patrícia Soares Canela > Sent: Monday, June 03, 2002 2:18 PM > To: [EMAIL PROTECTED] > Subject: RE: [JBoss-dev] Problems using UserTransaction > > > OK! > > So, do you know any way to implement cuncurrent processing with EJBs. > If I cannot use threads, how can I perform the execution of > several services > in the same transaction? > > > > -Original Message- > From: David Jencks [mailto:[EMAIL PROTECTED]] > Sent: segunda-feira, 3 de Junho de 2002 19:04 > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Problems using UserTransaction > > > You can't use your own threads in ejbs. It's against spec and > doesn't work > with transactions, as you have discovered. > > david jencks > > On 2002.06.03 13:37:54 -0400 Patrícia Soares Canela wrote: > > Hi there! > > > > I have this EJB, bean managed wich controls client's request and invokes > > other beans. > > I'm lauching threads to invilke these other beans. > > > > Supose that I have this transaction that needs to resort to three > > diferent > > beans; supose that the second bean fails and transaction must be rolled > > back. > > > > Well, this isn´t happening! In fact, transaction is rolled back, but all > > previous data has been persisted in database. > > > > Is it because of using threads or is it something in transactions that > > I´m > > doing wrong. > > > > > > Thank you for your atention > > > > Patrícia > > > > > > > > > > ___ > > > > Don't miss the 2002 Sprint PCS Application Developer's Conference > > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-development > > > > > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Problems using UserTransaction
Ok! It works! Thanks a lot :) Patrícia -Original Message- From: Bill Burke [mailto:[EMAIL PROTECTED]] Sent: segunda-feira, 3 de Junho de 2002 19:27 To: [EMAIL PROTECTED] Subject: RE: [JBoss-dev] Problems using UserTransaction This may or may not workgive it a try and tell me if it works. Use the TransactionManager directly. void someEJBMethod() { InitialContext ctx = new InitialContext(); TransactionManager tm = (TransactionManager)ctx.lookup("java:/TransactionManager"); Transaction tx = tm.getTransaction(); //... //... Create your threads and pass in the tx as a parameter } // Thread code void run() { tm.resume(this.tx); //... do your stuff } Am I making sense? Regards, Bill Burke JBossGroup --- Don't forget to vote for JBoss for the JDJ Awards! http://www.sys-con.com/java/readerschoice2002/nominationform.cfm > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Patrícia Soares Canela > Sent: Monday, June 03, 2002 2:18 PM > To: [EMAIL PROTECTED] > Subject: RE: [JBoss-dev] Problems using UserTransaction > > > OK! > > So, do you know any way to implement cuncurrent processing with EJBs. > If I cannot use threads, how can I perform the execution of > several services > in the same transaction? > > > > -Original Message- > From: David Jencks [mailto:[EMAIL PROTECTED]] > Sent: segunda-feira, 3 de Junho de 2002 19:04 > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Problems using UserTransaction > > > You can't use your own threads in ejbs. It's against spec and > doesn't work > with transactions, as you have discovered. > > david jencks > > On 2002.06.03 13:37:54 -0400 Patrícia Soares Canela wrote: > > Hi there! > > > > I have this EJB, bean managed wich controls client's request and invokes > > other beans. > > I'm lauching threads to invilke these other beans. > > > > Supose that I have this transaction that needs to resort to three > > diferent > > beans; supose that the second bean fails and transaction must be rolled > > back. > > > > Well, this isn´t happening! In fact, transaction is rolled back, but all > > previous data has been persisted in database. > > > > Is it because of using threads or is it something in transactions that > > I´m > > doing wrong. > > > > > > Thank you for your atention > > > > Patrícia > > > > > > > > > > ___ > > > > Don't miss the 2002 Sprint PCS Application Developer's Conference > > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/jboss-development > > > > > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ > > Don't miss the 2002 Sprint PCS Application Developer's Conference > August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Problems using UserTransaction
Another way would be using MDB. Examples in the docos. Works fine for me. Patrícia Soares Canela wrote: >Ok! It works! > >Thanks a lot :) >Patrícia > >-Original Message- >From: Bill Burke [mailto:[EMAIL PROTECTED]] >Sent: segunda-feira, 3 de Junho de 2002 19:27 >To: [EMAIL PROTECTED] >Subject: RE: [JBoss-dev] Problems using UserTransaction > > >This may or may not workgive it a try and tell me if it works. > >Use the TransactionManager directly. > >void someEJBMethod() >{ > InitialContext ctx = new InitialContext(); > TransactionManager tm = >(TransactionManager)ctx.lookup("java:/TransactionManager"); > Transaction tx = tm.getTransaction(); > //... > //... Create your threads and pass in the tx as a parameter > >} > >// Thread code >void run() >{ >tm.resume(this.tx); >//... do your stuff >} > >Am I making sense? > >Regards, > >Bill Burke >JBossGroup >--- >Don't forget to vote >for JBoss for the JDJ Awards! >http://www.sys-con.com/java/readerschoice2002/nominationform.cfm > > >>-Original Message- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED]]On Behalf Of >>Patrícia Soares Canela >>Sent: Monday, June 03, 2002 2:18 PM >>To: [EMAIL PROTECTED] >>Subject: RE: [JBoss-dev] Problems using UserTransaction >> >> >>OK! >> >>So, do you know any way to implement cuncurrent processing with EJBs. >>If I cannot use threads, how can I perform the execution of >>several services >>in the same transaction? >> >> >> >>-Original Message- >>From: David Jencks [mailto:[EMAIL PROTECTED]] >>Sent: segunda-feira, 3 de Junho de 2002 19:04 >>To: [EMAIL PROTECTED] >>Subject: Re: [JBoss-dev] Problems using UserTransaction >> >> >>You can't use your own threads in ejbs. It's against spec and >>doesn't work >>with transactions, as you have discovered. >> >>david jencks >> >>On 2002.06.03 13:37:54 -0400 Patrícia Soares Canela wrote: >> >>>Hi there! >>> >>>I have this EJB, bean managed wich controls client's request and invokes >>>other beans. >>>I'm lauching threads to invilke these other beans. >>> >>>Supose that I have this transaction that needs to resort to three >>>diferent >>>beans; supose that the second bean fails and transaction must be rolled >>>back. >>> >>>Well, this isn´t happening! In fact, transaction is rolled back, but all >>>previous data has been persisted in database. >>> >>>Is it because of using threads or is it something in transactions that >>>I´m >>>doing wrong. >>> >>> >>>Thank you for your atention >>> >>>Patrícia >>> >>> >>> >>> >>>___ >>> >>>Don't miss the 2002 Sprint PCS Application Developer's Conference >>>August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm >>> >>>___ >>>Jboss-development mailing list >>>[EMAIL PROTECTED] >>>https://lists.sourceforge.net/lists/listinfo/jboss-development >>> >>> >>___ >> >>Don't miss the 2002 Sprint PCS Application Developer's Conference >>August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm >> >>___ >>Jboss-development mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/jboss-development >> >>___ >> >>Don't miss the 2002 Sprint PCS Application Developer's Conference >>August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm >> >>___ >>Jboss-development mailing list >>[EMAIL PROTECTED] >>https://lists.sourceforge.net/lists/listinfo/jboss-development >> > > >___ > >Don't miss the 2002 Sprint PCS Application Developer's Conference >August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > >___ >Jboss-development mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/jboss-development > >___ > >Don't miss the 2002 Sprint PCS Application Developer's Conference >August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm > >___ >Jboss-development mailing list >[EMAIL PROTECTED] >https://lists.sourceforge.net/lists/listinfo/jboss-development > > > ___ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development