Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Pool Puzzle Solution

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm quite sure that the Pool Puzzle Solution in HFE book, page 515 is not correct.
The sequence
ut.begin();
c.cmtRequiresNew();
c.cmtMandatory();
c.cmtRequiresNew();
ut.commit()
will result in exception at attempt to call the second cmtRequiresNew(). It would mean that the session bean keeps pending changes from cmtMandatory() (that transaction is not over yet) and is asked to start new transaction. As I understand, it will not work, definitely with statefull session beans.
Can anyone comment on this?
Regards, Viktor
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

will result in exception at attempt to call the second cmtRequiresNew().[/QB]


I think you're right. If "c" is a CMT bean it get's tainted with the BMT transaction that's not over yet (from c.cmtMandatory()). At that point, the bean is turquoise*, and no method in that bean is allowed to run under any other transaction until the transaction that tainted the bean is closed.
Kathy?
--Dale--
*(see my post from today)
 
Viktor Sadovnikov
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dale,
Do you have an answer on your question?
Regards,
Viktor
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viktor,
Have you checked out the link Dale gave? It's a long post that fully explains your question.
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an old thread, just wondering if anyone had the same problem with the transaction pool puzzle.

Read through the discussion on the other thread offered by Dale.

I had to disagree that the pool puzzle is in the same situation. Meaning, I don't see a nested transaction danger here.

For a nested transaction to happen, we've to have a method, with a pre-existing context, that calls another method that requires a new context, without the existing context being closed.

Here, none of the CMT bean's methods are invoking another method that requires a new context (at least we cannot tell from the information we've).

The second invocation of cmtRequiresNew() does not cause nested transactions to happen.
 
I'm so happy! And I wish to make this tiny ad happy too:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic