• 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

CMT - Pooled connection availability

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have a stateless session bean, whose transactions are container managed,
Lets say I am calling a method sslb() as below:

Now When I close the connection in step 5, will the connection be available to the next user request OR container will wait till step 6 is completed then do a commit/rollback and then release the connection for next user?

Thanks
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the transaction is a 1PC, even after closing the connection, the connection object will not be released to the pool. The connection will be retained until the transaction is rollbacked or committed. That should happen at the end of the method call.

To overcome this problem, move your data processing code outside the method or make the transaction BMT. Using BMT you can control the transaction semantics and thus define the transactional boundaries.

In case of 2PC, the connection object involved in CRUD (Create, Read, Update and Delete) operations and commit or rollback need not be the same. 2PC uses a combination of xid a unique identifier and branch to identify the transaction in progress. Thus it can use two different connection objects for CRUD and commit/rollback operations.
 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
So do you mean that in a 2PC the connection is immediately available after closing it?
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That will depend upon the application server implementation, but the 2PC protocol is designed such that the application server can free up resources. Each application server will have its own optimization philosophy around this. So unfortunately one cannot predict if the resource release will happen or not.
 
Babji Reddy
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you suggest some references with such info?
Thanks
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately I do doubt you will get any documented information. You would need to look up blogs. For information on websphere visit their developerworks site.

Sorry that I could not provide you specific inputs on the same.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic