File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateless sesssion beans & Transactions

 
Roland Winter
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Roland Winter
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent idea Lasse! Thanks, I'll give that a go.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic