aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Stateless sesssion beans & Transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateless sesssion beans & Transactions" Watch "Stateless sesssion beans & Transactions" New topic
Author

Stateless sesssion beans & Transactions

Roland Winter
Greenhorn

Joined: May 11, 2003
Posts: 7
Hi,
I'm using stateless session beans for the project I'm currently working on. I understand that the container can instantiate as many instances of each bean as it feels it needs.
I have one particular method that requires that it is the ONLY one running at any one particular time no matter which instance it was invoked on.
Does the container handle this automatically or do I need to specify something on the method, at deployment time or . . . .I don't know what else there is.
Any suggestions/solutions will be greatly appreciated
Thanks
ROland
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
How about extracting that one method into a separate bean and configure the maximum pool size to 1 using the vendor deployment descriptor? Otherwise you'd have to either make a similar limitation to the whole bean, or play with the synchronized keyword, which is a bit dangerous (disallowed by the specification).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Roland Winter
Greenhorn

Joined: May 11, 2003
Posts: 7
Excellent idea Lasse! Thanks, I'll give that a go.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stateless sesssion beans & Transactions