• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a EJB with threading

 
William Ross
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it the ejb takes care of threading for us? What I am trying to do is syncronize a method so that only one thread can be using it at a time. However, I get an error when I try to use syncronize. What I think is happening is the ejb is running multiple instances of this method at a time due to threading. But I want only one flow of control within this method. Sorry if this sounds confusing; I can clarify more... thanks.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In J2EE, you generally should avoid any and all thread management. In particular, you should never spawn threads.

What do you need synchronized methods for? If it is for a static object, there are better solutions to manage singletons in a J2EE environment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic