• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pool Puzzle Solution

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic