• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pool Puzzle Solution

 
Viktor Sadovnikov
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
 
Dale Seng
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
 
Nathaniel Stoddard
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.
 
Chengwei Lee
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Similar Threads