Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes EJB and other Java EE Technologies and the fly likes Using a EJB with threading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Using a EJB with threading" Watch "Using a EJB with threading" New topic
Author

Using a EJB with threading

William Ross
Greenhorn

Joined: Jul 06, 2006
Posts: 12
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

Joined: Oct 23, 2005
Posts: 3740
    
  10

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.


[OCA 8 Book] [Blog]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a EJB with threading